From 4a8b3a48e1586103ecd8bac3113a80ad4b14ce4d Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sat, 8 Jun 2019 23:42:51 +0200 Subject: [PATCH] Add first version of the diesel schema and models --- Cargo.lock | 250 +++++++++++ Cargo.toml | 14 +- diesel.toml | 6 + migrations/.gitkeep | 0 .../down.sql | 1 + .../up.sql | 24 + .../down.sql | 1 + .../2019-06-08-190258_create_customers/up.sql | 15 + .../down.sql | 1 + .../2019-06-08-190712_create_invoices/up.sql | 10 + .../2019-06-08-190852_create_tasks/down.sql | 1 + .../2019-06-08-190852_create_tasks/up.sql | 12 + .../down.sql | 1 + .../up.sql | 10 + src/main.rs | 4 + src/models.rs | 13 + src/models/company_info.rs | 54 +++ src/models/customer.rs | 36 ++ src/models/invoice.rs | 26 ++ src/models/task.rs | 30 ++ src/models/time_entry.rs | 25 ++ src/schema.rs | 413 ++++++++++++++++++ 22 files changed, 946 insertions(+), 1 deletion(-) create mode 100644 diesel.toml create mode 100644 migrations/.gitkeep create mode 100644 migrations/2019-06-08-185935_create_company_infos/down.sql create mode 100644 migrations/2019-06-08-185935_create_company_infos/up.sql create mode 100644 migrations/2019-06-08-190258_create_customers/down.sql create mode 100644 migrations/2019-06-08-190258_create_customers/up.sql create mode 100644 migrations/2019-06-08-190712_create_invoices/down.sql create mode 100644 migrations/2019-06-08-190712_create_invoices/up.sql create mode 100644 migrations/2019-06-08-190852_create_tasks/down.sql create mode 100644 migrations/2019-06-08-190852_create_tasks/up.sql create mode 100644 migrations/2019-06-08-191009_create_time_entries/down.sql create mode 100644 migrations/2019-06-08-191009_create_time_entries/up.sql create mode 100644 src/models.rs create mode 100644 src/models/company_info.rs create mode 100644 src/models/customer.rs create mode 100644 src/models/invoice.rs create mode 100644 src/models/task.rs create mode 100644 src/models/time_entry.rs create mode 100644 src/schema.rs diff --git a/Cargo.lock b/Cargo.lock index bba67ea..8fb0d92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,13 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.11" @@ -10,6 +18,32 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "base64" version = "0.9.3" @@ -47,6 +81,17 @@ name = "cfg-if" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cookie" version = "0.11.1" @@ -87,6 +132,57 @@ dependencies = [ "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "diesel" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsqlite3-sys 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "diesel_derives" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dotenv" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "filetime" version = "0.2.5" @@ -193,6 +289,11 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -222,6 +323,15 @@ name = "libc" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libsqlite3-sys" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.3.9" @@ -323,6 +433,23 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num_cpus" version = "1.10.0" @@ -361,6 +488,11 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro2" version = "0.4.30" @@ -390,6 +522,26 @@ dependencies = [ "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "regex" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ring" version = "0.13.5" @@ -442,6 +594,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -460,6 +614,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-demangle" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ryu" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "safemem" version = "0.3.0" @@ -478,6 +642,26 @@ name = "serde" version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "serde_derive" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "slab" version = "0.4.2" @@ -497,8 +681,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "stoptime" version = "0.1.0" dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_contrib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -511,6 +701,17 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synstructure" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "termion" version = "1.5.2" @@ -522,6 +723,14 @@ dependencies = [ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "time" version = "0.1.42" @@ -550,6 +759,11 @@ name = "typeable" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicase" version = "1.4.2" @@ -594,6 +808,16 @@ dependencies = [ "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vcpkg" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "version_check" version = "0.1.5" @@ -666,17 +890,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0" "checksum devise 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" "checksum devise_codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" "checksum devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" +"checksum diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d24935ba50c4a8dc375a0fd1f8a2ba6bdbdc4125713126a74b965d6a01a06d7" +"checksum diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62a27666098617d52c487a41f70de23d44a1dc1f3aa5877ceba2790fb1f1cab4" +"checksum dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4424bad868b0ffe6ae351ee463526ba625bbca817978293bbe6bb7dc1804a175" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" "checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" "checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" @@ -689,11 +923,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" "checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" +"checksum libsqlite3-sys 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd6457c70bbff456d9fe49deaba35ec47c3e598bf8d7950ff0575ceb7a8a6ad1" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" @@ -704,38 +940,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3572d71f13ea8ed41867accd971fd564aa75934cf7a1fae03ddb8c74a8a49943" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c26d2b92e47063ffce70d3e3b1bd097af121a9e0db07ca38a6cc1cf0cc85ff25" "checksum pear_codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "336db4a192cc7f54efeb0c4e11a9245394824cc3bcbd37ba3ff51240c35d7a6e" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" +"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55b83fcf219c8b4980220231d5dd9eae167bdc63449fdab0a04b6c8b8cd361a8" "checksum rocket_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5549dc59a729fbd0e6f5d5de33ba136340228871633485e4946664d36289ffd7" "checksum rocket_contrib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5af691b5f5c06c3a30213217696681d3d3bdc2f10428fa3ce6bbaeab156b6409" "checksum rocket_http 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "abec045da00893bd4eef6084307a4bec0742278a7635a6a8b943da023202a5f7" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be" +"checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" "checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index bf00b15..5fd0696 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,20 @@ edition = "2018" [dependencies] rocket = "0.4.1" +serde = "1.0.92" +serde_json = "1.0.39" +serde_derive = "1.0.92" +dotenv = "0.14.1" + +[dependencies.chrono] +version = "0.4.6" +features = ["serde"] + +[dependencies.diesel] +version = "1.4.2" +features = ["chrono", "sqlite"] [dependencies.rocket_contrib] version = "0.4.1" default-features = false -features = ["serve"] +features = ["json", "serve"] diff --git a/diesel.toml b/diesel.toml new file mode 100644 index 0000000..6ab2ab1 --- /dev/null +++ b/diesel.toml @@ -0,0 +1,6 @@ +# For documentation on how to configure this file, +# see diesel.rs/guides/configuring-diesel-cli + +[print_schema] +file = "src/schema.rs" +with_docs = true diff --git a/migrations/.gitkeep b/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/migrations/2019-06-08-185935_create_company_infos/down.sql b/migrations/2019-06-08-185935_create_company_infos/down.sql new file mode 100644 index 0000000..6bc7bc6 --- /dev/null +++ b/migrations/2019-06-08-185935_create_company_infos/down.sql @@ -0,0 +1 @@ +DROP TABLE company_infos diff --git a/migrations/2019-06-08-185935_create_company_infos/up.sql b/migrations/2019-06-08-185935_create_company_infos/up.sql new file mode 100644 index 0000000..62e5267 --- /dev/null +++ b/migrations/2019-06-08-185935_create_company_infos/up.sql @@ -0,0 +1,24 @@ +CREATE TABLE company_infos ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + "accountiban" VARCHAR(255) NOT NULL, + "accountname" VARCHAR(255) NOT NULL, + "accountno" VARCHAR(255) NOT NULL, + "address_city" VARCHAR(255) NOT NULL, + "address_postal_code" VARCHAR(255) NOT NULL, + "address_street" VARCHAR(255) NOT NULL, + "bank_bic" VARCHAR(255) NOT NULL, + "bank_name" VARCHAR(255) NOT NULL, + "cell" VARCHAR(255) NOT NULL, + "chamber" VARCHAR(255) NOT NULL, + "contact_name" VARCHAR(255) NOT NULL, + "country" VARCHAR(255) NOT NULL, + "country_code" VARCHAR(255) NOT NULL, + "email" VARCHAR(255) NOT NULL, + "name" VARCHAR(255) NOT NULL, + "original_id" INTEGER, + "phone" VARCHAR(255) NOT NULL, + "vatno" VARCHAR(255) NOT NULL, + "website" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) diff --git a/migrations/2019-06-08-190258_create_customers/down.sql b/migrations/2019-06-08-190258_create_customers/down.sql new file mode 100644 index 0000000..55ed5d5 --- /dev/null +++ b/migrations/2019-06-08-190258_create_customers/down.sql @@ -0,0 +1 @@ +DROP TABLE customers diff --git a/migrations/2019-06-08-190258_create_customers/up.sql b/migrations/2019-06-08-190258_create_customers/up.sql new file mode 100644 index 0000000..0741302 --- /dev/null +++ b/migrations/2019-06-08-190258_create_customers/up.sql @@ -0,0 +1,15 @@ +CREATE TABLE customers ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + "address_city" VARCHAR(255) NOT NULL, + "address_postal_code" VARCHAR(255) NOT NULL, + "address_street" VARCHAR(255) NOT NULL, + "email" VARCHAR(255) NOT NULL, + "financial_contact" VARCHAR(255) NOT NULL, + "hourly_rate" FLOAT, + "name" VARCHAR(255) NOT NULL, + "phone" VARCHAR(255) NOT NULL, + "short_name" VARCHAR(255) NOT NULL, + "time_specification" BOOLEAN NOT NULL, + "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) diff --git a/migrations/2019-06-08-190712_create_invoices/down.sql b/migrations/2019-06-08-190712_create_invoices/down.sql new file mode 100644 index 0000000..d54eecc --- /dev/null +++ b/migrations/2019-06-08-190712_create_invoices/down.sql @@ -0,0 +1 @@ +DROP TABLE invoices diff --git a/migrations/2019-06-08-190712_create_invoices/up.sql b/migrations/2019-06-08-190712_create_invoices/up.sql new file mode 100644 index 0000000..d4f9d39 --- /dev/null +++ b/migrations/2019-06-08-190712_create_invoices/up.sql @@ -0,0 +1,10 @@ +CREATE TABLE invoices ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + "company_info_id" INTEGER NOT NULL, + "customer_id" INTEGER NOT NULL, + "include_specification" BOOLEAN NOT NULL, + "number" INTEGER NOT NULL, + "paid" BOOLEAN NOT NULL, + "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) diff --git a/migrations/2019-06-08-190852_create_tasks/down.sql b/migrations/2019-06-08-190852_create_tasks/down.sql new file mode 100644 index 0000000..a76b653 --- /dev/null +++ b/migrations/2019-06-08-190852_create_tasks/down.sql @@ -0,0 +1 @@ +DROP TABLE tasks diff --git a/migrations/2019-06-08-190852_create_tasks/up.sql b/migrations/2019-06-08-190852_create_tasks/up.sql new file mode 100644 index 0000000..5f7f4fe --- /dev/null +++ b/migrations/2019-06-08-190852_create_tasks/up.sql @@ -0,0 +1,12 @@ +CREATE TABLE tasks ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + "customer_id" INTEGER NOT NULL, + "fixed_cost" FLOAT, + "hourly_rate" FLOAT, + "invoice_comment" VARCHAR(255) NOT NULL, + "invoice_id" INTEGER, + "name" VARCHAR(255) NOT NULL, + "vat_rate" FLOAT NOT NULL, + "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) diff --git a/migrations/2019-06-08-191009_create_time_entries/down.sql b/migrations/2019-06-08-191009_create_time_entries/down.sql new file mode 100644 index 0000000..d3844fe --- /dev/null +++ b/migrations/2019-06-08-191009_create_time_entries/down.sql @@ -0,0 +1 @@ +DROP TABLE time_entries diff --git a/migrations/2019-06-08-191009_create_time_entries/up.sql b/migrations/2019-06-08-191009_create_time_entries/up.sql new file mode 100644 index 0000000..b7d229c --- /dev/null +++ b/migrations/2019-06-08-191009_create_time_entries/up.sql @@ -0,0 +1,10 @@ +CREATE TABLE time_entries ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + "bill" BOOLEAN NOT NULL, + "comment" VARCHAR(255) NOT NULL, + "end" TIMESTAMP NOT NULL, + "start" TIMESTAMP NOT NULL, + "task_id" INTEGER NOT NULL, + "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) diff --git a/src/main.rs b/src/main.rs index 275c0c7..d1b9d22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,9 @@ +#![recursion_limit = "256"] #![feature(proc_macro_hygiene, decl_macro)] +#[macro_use] +extern crate diesel; + use rocket::{routes, Rocket}; use rocket_contrib::serve::StaticFiles; diff --git a/src/models.rs b/src/models.rs new file mode 100644 index 0000000..1092c7b --- /dev/null +++ b/src/models.rs @@ -0,0 +1,13 @@ +//! The application models + +mod company_info; +mod customer; +mod invoice; +mod task; +mod time_entry; + +pub use company_info::CompanyInfo; +pub use customer::Customer; +pub use invoice::Invoice; +pub use task::Task; +pub use time_entry::TimeEntry; diff --git a/src/models/company_info.rs b/src/models/company_info.rs new file mode 100644 index 0000000..8cf2d53 --- /dev/null +++ b/src/models/company_info.rs @@ -0,0 +1,54 @@ +use chrono::NaiveDateTime; +use serde_derive::{Deserialize, Serialize}; + +/// The company (information) model +/// +/// This model represents information about the company or sole proprietorship of the user of +/// StopTime. +#[derive(Deserialize, Queryable, Serialize)] +pub struct CompanyInfo { + /// The unique identification number + pub id: i32, + /// The international bank account number + pub accountiban: String, + /// The name of the bank account holder + pub accountname: String, + /// The number of the bank account + pub accountno: String, + /// The city part of the address + pub address_city: String, + /// The postal code part of the address + pub address_postal_code: String, + /// The street part of the address + pub address_street: String, + /// The bank identification code (or: SWIFT code) + pub bank_bic: String, + /// The name of the bank + pub bank_name: String, + /// The cellular phone number + pub cell: String, + // The chamber of commerce ID number + pub chamber: String, + /// The personal contact name + pub contact_name: String, + /// The country of residence + pub country: String, + /// The two letter country code + pub country_code: String, + /// The email address + pub email: String, + /// The official company name + pub name: String, + /// The ID of the previous company information model (if any) + pub original_id: Option, + // The phone number + pub phone: String, + /// The VAT number + pub vatno: String, + /// The website + pub website: String, + /// The time of creation + pub created_at: NaiveDateTime, + /// The time of last update + pub updated_at: NaiveDateTime, +} diff --git a/src/models/customer.rs b/src/models/customer.rs new file mode 100644 index 0000000..71d0cda --- /dev/null +++ b/src/models/customer.rs @@ -0,0 +1,36 @@ +use chrono::NaiveDateTime; +use serde_derive::{Deserialize, Serialize}; + +/// The customer model +/// +/// This model represents a customer that has projects/tasks for which invoices need to be +/// generated. +#[derive(Deserialize, Queryable, Serialize)] +pub struct Customer { + /// The unique identification number + pub id: i32, + /// The city part of the address + pub address_city: String, + /// The postal code part of the address + pub address_postal_code: String, + /// The street part of the address + pub address_street: String, + /// The email address + pub email: String, + /// The name of the financial contact person/department + pub financial_contact: String, + /// The default hourly rate (if applicable) + pub hourly_rate: Option, + /// The official (long) name + pub name: String, + /// The phone number + pub phone: String, + /// The abbreviated name + pub short_name: String, + /// Flag whether the customer requires time specificaions + pub time_specification: bool, + /// The time of creation + pub created_at: NaiveDateTime, + /// The time of last update + pub updated_at: NaiveDateTime, +} diff --git a/src/models/invoice.rs b/src/models/invoice.rs new file mode 100644 index 0000000..aef19bc --- /dev/null +++ b/src/models/invoice.rs @@ -0,0 +1,26 @@ +use chrono::NaiveDateTime; +use serde_derive::{Deserialize, Serialize}; + +/// The invoice model +/// +/// This model represents an invoice for a customer that contains billed tasks and through the +/// tasks the registered time. +#[derive(Deserialize, Queryable, Serialize)] +pub struct Invoice { + /// The unique identification number + pub id: i32, + /// The ID of the company info at the time of billing + pub company_info_id: i32, + /// The ID of associated customer + pub customer_id: i32, + /// Flag whether the invoice should include a time specification + pub include_specification: bool, + /// The invoice number + pub number: i32, + /// Flag whether the invoice has been paid + pub paid: bool, + /// The time of creation + pub created_at: NaiveDateTime, + /// The time of last update + pub updated_at: NaiveDateTime, +} diff --git a/src/models/task.rs b/src/models/task.rs new file mode 100644 index 0000000..0f46d5c --- /dev/null +++ b/src/models/task.rs @@ -0,0 +1,30 @@ +use chrono::NaiveDateTime; +use serde_derive::{Deserialize, Serialize}; + +/// The task model +/// +/// This model represents a task (or project) of a customer on which time can be registered. +/// generated. +#[derive(Deserialize, Queryable, Serialize)] +pub struct Task { + /// The unique identification number + pub id: i32, + /// The ID of the associated customer + pub customer_id: i32, + /// The fixed cost of the task (if applicable) + pub fixed_cost: Option, + /// The hourly rate of the task (if applicable) + pub hourly_rate: Option, + /// An extra comment for on the invoice + pub invoice_comment: String, + /// The associated invoice (if billed) + pub invoice_id: Option, + /// The name/description + pub name: String, + /// The VAT rate (at time of billing) + pub vat_rate: f32, + /// The time of creation + pub created_at: NaiveDateTime, + /// The time of last update + pub updated_at: NaiveDateTime, +} diff --git a/src/models/time_entry.rs b/src/models/time_entry.rs new file mode 100644 index 0000000..cb2eef3 --- /dev/null +++ b/src/models/time_entry.rs @@ -0,0 +1,25 @@ +use chrono::NaiveDateTime; +use serde_derive::{Deserialize, Serialize}; + +/// The time entry model +/// +/// This model represents an amount of time that is registered for a certain task. +#[derive(Deserialize, Queryable, Serialize)] +pub struct TimeEntry { + /// The unique identification number + pub id: i32, + /// Flag whether to bill or not + pub bill: bool, + /// An additional comment + pub comment: String, + /// The finish/end time of the entry + pub end: NaiveDateTime, + /// The start time of the entry + pub start: NaiveDateTime, + /// The ID of the task the entry is registered for + pub task_id: i32, + /// The time of creation + pub created_at: NaiveDateTime, + /// The time of last update + pub updated_at: NaiveDateTime, +} diff --git a/src/schema.rs b/src/schema.rs new file mode 100644 index 0000000..d1f38a8 --- /dev/null +++ b/src/schema.rs @@ -0,0 +1,413 @@ +table! { + /// Representation of the `company_infos` table. + /// + /// (Automatically generated by Diesel.) + company_infos (id) { + /// The `id` column of the `company_infos` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + id -> Integer, + /// The `accountiban` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + accountiban -> Text, + /// The `accountname` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + accountname -> Text, + /// The `accountno` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + accountno -> Text, + /// The `address_city` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_city -> Text, + /// The `address_postal_code` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_postal_code -> Text, + /// The `address_street` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_street -> Text, + /// The `bank_bic` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + bank_bic -> Text, + /// The `bank_name` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + bank_name -> Text, + /// The `cell` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + cell -> Text, + /// The `chamber` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + chamber -> Text, + /// The `contact_name` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + contact_name -> Text, + /// The `country` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + country -> Text, + /// The `country_code` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + country_code -> Text, + /// The `email` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + email -> Text, + /// The `name` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + name -> Text, + /// The `original_id` column of the `company_infos` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + original_id -> Nullable, + /// The `phone` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + phone -> Text, + /// The `vatno` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + vatno -> Text, + /// The `website` column of the `company_infos` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + website -> Text, + /// The `created_at` column of the `company_infos` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamp, + /// The `updated_at` column of the `company_infos` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamp, + } +} + +table! { + /// Representation of the `customers` table. + /// + /// (Automatically generated by Diesel.) + customers (id) { + /// The `id` column of the `customers` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + id -> Integer, + /// The `address_city` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_city -> Text, + /// The `address_postal_code` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_postal_code -> Text, + /// The `address_street` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + address_street -> Text, + /// The `email` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + email -> Text, + /// The `financial_contact` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + financial_contact -> Text, + /// The `hourly_rate` column of the `customers` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + hourly_rate -> Nullable, + /// The `name` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + name -> Text, + /// The `phone` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + phone -> Text, + /// The `short_name` column of the `customers` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + short_name -> Text, + /// The `time_specification` column of the `customers` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + time_specification -> Bool, + /// The `created_at` column of the `customers` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamp, + /// The `updated_at` column of the `customers` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamp, + } +} + +table! { + /// Representation of the `invoices` table. + /// + /// (Automatically generated by Diesel.) + invoices (id) { + /// The `id` column of the `invoices` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + id -> Integer, + /// The `company_info_id` column of the `invoices` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + company_info_id -> Integer, + /// The `customer_id` column of the `invoices` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + customer_id -> Integer, + /// The `include_specification` column of the `invoices` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + include_specification -> Bool, + /// The `number` column of the `invoices` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + number -> Integer, + /// The `paid` column of the `invoices` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + paid -> Bool, + /// The `created_at` column of the `invoices` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamp, + /// The `updated_at` column of the `invoices` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamp, + } +} + +table! { + /// Representation of the `tasks` table. + /// + /// (Automatically generated by Diesel.) + tasks (id) { + /// The `id` column of the `tasks` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + id -> Integer, + /// The `customer_id` column of the `tasks` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + customer_id -> Integer, + /// The `fixed_cost` column of the `tasks` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + fixed_cost -> Nullable, + /// The `hourly_rate` column of the `tasks` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + hourly_rate -> Nullable, + /// The `invoice_comment` column of the `tasks` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + invoice_comment -> Text, + /// The `invoice_id` column of the `tasks` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + invoice_id -> Nullable, + /// The `name` column of the `tasks` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + name -> Text, + /// The `vat_rate` column of the `tasks` table. + /// + /// Its SQL type is `Float`. + /// + /// (Automatically generated by Diesel.) + vat_rate -> Float, + /// The `created_at` column of the `tasks` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamp, + /// The `updated_at` column of the `tasks` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamp, + } +} + +table! { + /// Representation of the `time_entries` table. + /// + /// (Automatically generated by Diesel.) + time_entries (id) { + /// The `id` column of the `time_entries` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + id -> Integer, + /// The `bill` column of the `time_entries` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + bill -> Bool, + /// The `comment` column of the `time_entries` table. + /// + /// Its SQL type is `Text`. + /// + /// (Automatically generated by Diesel.) + comment -> Text, + /// The `end` column of the `time_entries` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + end -> Timestamp, + /// The `start` column of the `time_entries` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + start -> Timestamp, + /// The `task_id` column of the `time_entries` table. + /// + /// Its SQL type is `Integer`. + /// + /// (Automatically generated by Diesel.) + task_id -> Integer, + /// The `created_at` column of the `time_entries` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamp, + /// The `updated_at` column of the `time_entries` table. + /// + /// Its SQL type is `Timestamp`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamp, + } +} + +allow_tables_to_appear_in_same_query!( + company_infos, + customers, + invoices, + tasks, + time_entries, +);