diff options
Diffstat (limited to 'backend')
116 files changed, 0 insertions, 9213 deletions
diff --git a/backend/Cargo.lock b/backend/Cargo.lock deleted file mode 100644 index 63c4de0..0000000 --- a/backend/Cargo.lock +++ /dev/null @@ -1,2078 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "actualbudget_importer" -version = "0.1.0" -dependencies = [ - "anyhow", - "budgeting_app_core", - "chrono", - "diesel", - "libsqlite3-sys", -] - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" - -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "async-trait" -version = "0.1.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atomic" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" - -[[package]] -name = "atomic" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "budgeting_app_backend" -version = "0.1.0" -dependencies = [ - "budgeting_app_core", - "cfg-if", - "chrono", - "diesel", - "diesel_migrations", - "dotenvy", - "rocket", - "rocket_sync_db_pools", - "rusqlite", -] - -[[package]] -name = "budgeting_app_core" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "derive_builder", - "diesel", - "diesel_migrations", - "libsqlite3-sys", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "bytemuck" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" - -[[package]] -name = "cc" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets 0.52.6", -] - -[[package]] -name = "cookie" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_builder" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_macro" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" -dependencies = [ - "derive_builder_core", - "syn", -] - -[[package]] -name = "devise" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d90b0c4c777a2cad215e3c7be59ac7c15adf45cf76317009b7d096d46f651d" -dependencies = [ - "devise_codegen", - "devise_core", -] - -[[package]] -name = "devise_codegen" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b28680d8be17a570a2334922518be6adc3f58ecc880cbb404eaeb8624fd867" -dependencies = [ - "devise_core", - "quote", -] - -[[package]] -name = "devise_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b035a542cf7abf01f2e3c4d5a7acbaebfefe120ae4efc7bde3df98186e4b8af7" -dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", -] - -[[package]] -name = "diesel" -version = "2.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e" -dependencies = [ - "diesel_derives", - "libsqlite3-sys", - "r2d2", - "time", -] - -[[package]] -name = "diesel_derives" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" -dependencies = [ - "diesel_table_macro_syntax", - "dsl_auto_type", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel_migrations" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a73ce704bad4231f001bff3314d91dce4aba0770cee8b233991859abc15c1f6" -dependencies = [ - "diesel", - "migrations_internals", - "migrations_macros", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" -dependencies = [ - "syn", -] - -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - -[[package]] -name = "dsl_auto_type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" -dependencies = [ - "darling", - "either", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - -[[package]] -name = "fastrand" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" - -[[package]] -name = "figment" -version = "0.10.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" -dependencies = [ - "atomic 0.6.0", - "pear", - "serde", - "toml", - "uncased", - "version_check", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" - -[[package]] -name = "hashlink" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" -dependencies = [ - "hashbrown 0.14.5", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown 0.15.1", - "serde", -] - -[[package]] -name = "inlinable_string" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" - -[[package]] -name = "is-terminal" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.164" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" - -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "serde", - "serde_json", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "migrations_internals" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd01039851e82f8799046eabbb354056283fb265c8ec0996af940f4e85a380ff" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "migrations_macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb161cc72176cb37aa47f1fc520d3ef02263d67d661f44f05d05a079e1237fd" -dependencies = [ - "migrations_internals", - "proc-macro2", - "quote", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "wasi", - "windows-sys 0.52.0", -] - -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 1.1.0", - "httparse", - "memchr", - "mime", - "spin", - "tokio", - "tokio-util", - "version_check", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - -[[package]] -name = "object" -version = "0.36.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "pear" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" -dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi", -] - -[[package]] -name = "pear_codegen" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" -dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rocket" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a516907296a31df7dc04310e7043b61d71954d703b603cc6867a026d7e72d73f" -dependencies = [ - "async-stream", - "async-trait", - "atomic 0.5.3", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "log", - "memchr", - "multer", - "num_cpus", - "parking_lot", - "pin-project-lite", - "rand", - "ref-cast", - "rocket_codegen", - "rocket_http", - "serde", - "serde_json", - "state", - "tempfile", - "time", - "tokio", - "tokio-stream", - "tokio-util", - "ubyte", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_codegen" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46" -dependencies = [ - "devise", - "glob", - "indexmap", - "proc-macro2", - "quote", - "rocket_http", - "syn", - "unicode-xid", - "version_check", -] - -[[package]] -name = "rocket_http" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e274915a20ee3065f611c044bd63c40757396b6dbc057d6046aec27f14f882b9" -dependencies = [ - "cookie", - "either", - "futures", - "http 0.2.12", - "hyper", - "indexmap", - "log", - "memchr", - "pear", - "percent-encoding", - "pin-project-lite", - "ref-cast", - "serde", - "smallvec", - "stable-pattern", - "state", - "time", - "tokio", - "uncased", -] - -[[package]] -name = "rocket_sync_db_pools" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f32721ed79509adac4328e97f817a8f55a47c4b64799f6fd6cc3adb6e42ff" -dependencies = [ - "diesel", - "r2d2", - "rocket", - "rocket_sync_db_pools_codegen", - "serde", - "tokio", - "version_check", -] - -[[package]] -name = "rocket_sync_db_pools_codegen" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc890925dc79370c28eb15c9957677093fdb7e8c44966d189f38cedb995ee68" -dependencies = [ - "devise", - "quote", -] - -[[package]] -name = "rusqlite" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" -dependencies = [ - "bitflags", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustix" -version = "0.38.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.133" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "stable-pattern" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" -dependencies = [ - "memchr", -] - -[[package]] -name = "state" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" -dependencies = [ - "loom", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tokio" -version = "1.41.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-stream" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "ubyte" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f720def6ce1ee2fc44d40ac9ed6d3a59c361c80a75a7aa8e75bb9baed31cf2ea" -dependencies = [ - "serde", -] - -[[package]] -name = "uncased" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "serde", - "version_check", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" - -[[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-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] - -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -dependencies = [ - "is-terminal", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/backend/Cargo.toml b/backend/Cargo.toml deleted file mode 100644 index 015b688..0000000 --- a/backend/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[workspace] -members = [ - "actualbudget_importer", - "app", - "core", -] -resolver = "2" - -[workspace.dependencies] -anyhow = { version = "1.0.0" } -chrono = { version = "0.4.38" } -cfg-if = "1.0.0" -derive_builder = { version = "0.20.2" } -diesel = { version = "2.2.0" } -diesel_migrations = "2.2.0" -dotenvy = "0.15.7" -libsqlite3-sys = { version = "0.30.1" } -rocket = { version = "0.5.1" } -rocket_sync_db_pools = { version = "0.1.0" } -rusqlite = { version = "0.32.1" } -serde = { version = "1.0.209", features = ["derive"] } diff --git a/backend/actualbudget_importer/Cargo.lock b/backend/actualbudget_importer/Cargo.lock deleted file mode 100644 index edaab83..0000000 --- a/backend/actualbudget_importer/Cargo.lock +++ /dev/null @@ -1,679 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "actualbudget" -version = "0.1.0" -dependencies = [ - "anyhow", - "budgeting_app_core", - "chrono", - "diesel", - "libsqlite3-sys", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "budgeting_app_core" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "derive_builder", - "diesel", - "diesel_migrations", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cc" -version = "1.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_builder" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_macro" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" -dependencies = [ - "derive_builder_core", - "syn", -] - -[[package]] -name = "diesel" -version = "2.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e" -dependencies = [ - "diesel_derives", - "libsqlite3-sys", - "time", -] - -[[package]] -name = "diesel_derives" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" -dependencies = [ - "diesel_table_macro_syntax", - "dsl_auto_type", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel_migrations" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a73ce704bad4231f001bff3314d91dce4aba0770cee8b233991859abc15c1f6" -dependencies = [ - "diesel", - "migrations_internals", - "migrations_macros", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" -dependencies = [ - "syn", -] - -[[package]] -name = "dsl_auto_type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" -dependencies = [ - "darling", - "either", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "hashbrown" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "migrations_internals" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd01039851e82f8799046eabbb354056283fb265c8ec0996af940f4e85a380ff" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "migrations_macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb161cc72176cb37aa47f1fc520d3ef02263d67d661f44f05d05a079e1237fd" -dependencies = [ - "migrations_internals", - "proc-macro2", - "quote", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "wasm-bindgen" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] diff --git a/backend/actualbudget_importer/Cargo.toml b/backend/actualbudget_importer/Cargo.toml deleted file mode 100644 index 69d297f..0000000 --- a/backend/actualbudget_importer/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "actualbudget_importer" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow = { workspace = true } -budgeting_app_core = { path = "../core" } -chrono = { workspace = true, features = ["serde"] } -diesel = { workspace = true, features = ["sqlite"] } -libsqlite3-sys = { workspace = true, features = ["bundled"] } diff --git a/backend/actualbudget_importer/src/main.rs b/backend/actualbudget_importer/src/main.rs deleted file mode 100644 index cb69bb5..0000000 --- a/backend/actualbudget_importer/src/main.rs +++ /dev/null @@ -1,45 +0,0 @@ -pub mod models; -pub mod queries; -pub mod schema; -pub mod transformers; - -use anyhow::Result; -use budgeting_app_core::queries as budgeting_app_queries; -use diesel::{Connection, SqliteConnection}; -use queries::{actualbudget_accounts::{get_all_actualbudget_accounts, get_category_transfers_account}, actualbudget_categories::get_all_actualbudget_categories, actualbudget_transactions::{get_all_actualbudget_transactions, get_first_actualbudget_transaction_date}, actualbudget_zero_budgets::get_all_actualbudget_zero_budgets}; - -fn main() -> Result<()> { - let connection_src = &mut SqliteConnection::establish("in.sqlite").unwrap(); - let connection_dest = &mut SqliteConnection::establish("out.sqlite").unwrap(); - - let actualbudget_first_transaction_date = get_first_actualbudget_transaction_date(connection_src)?; - let actualbudget_accounts = get_all_actualbudget_accounts(connection_src)?; - let actualbudget_categories = get_all_actualbudget_categories(connection_src)?; - let actualbudget_zero_budgets = get_all_actualbudget_zero_budgets(connection_src)?; - let actualbudget_category_transfers_account = get_category_transfers_account(connection_src)?; - let actualbudget_transactions = get_all_actualbudget_transactions(connection_src)?; - - let first_transaction_date = transformers::transform_date(&actualbudget_first_transaction_date)?; - let accounts = - transformers::transform_accounts(&actualbudget_accounts, &first_transaction_date); - let categories = transformers::transform_categories(&actualbudget_categories); - let budget_updates = transformers::transform_budget_updates(&actualbudget_zero_budgets)?; - let (transactions, transaction_categorisations) = transformers::transform_transactions( - &actualbudget_transactions, - &actualbudget_category_transfers_account, - )?; - let category_transfers = transformers::transform_category_transfers( - &actualbudget_transactions, - &actualbudget_category_transfers_account, - ); - - budgeting_app_queries::clear::clear(connection_dest)?; - budgeting_app_queries::accounts::insert_accounts(&accounts, connection_dest)?; - budgeting_app_queries::categories::insert_categories(&categories, connection_dest)?; - budgeting_app_queries::budget_updates::insert_budget_updates(&budget_updates, connection_dest)?; - budgeting_app_queries::transactions::insert_transactions(&transactions, connection_dest)?; - budgeting_app_queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection_dest)?; - budgeting_app_queries::category_transfers::insert_category_transfers(&category_transfers, connection_dest)?; - - Ok(()) -} diff --git a/backend/actualbudget_importer/src/models/actualbudget_account.rs b/backend/actualbudget_importer/src/models/actualbudget_account.rs deleted file mode 100644 index b3d00ac..0000000 --- a/backend/actualbudget_importer/src/models/actualbudget_account.rs +++ /dev/null @@ -1,8 +0,0 @@ -use diesel::prelude::{Queryable, Selectable}; - -#[derive(Queryable, Selectable)] -#[diesel(table_name = crate::schema::accounts)] -pub struct ActualbudgetAccount { - pub id: String, - pub name: String, -} diff --git a/backend/actualbudget_importer/src/models/actualbudget_category.rs b/backend/actualbudget_importer/src/models/actualbudget_category.rs deleted file mode 100644 index cbea99b..0000000 --- a/backend/actualbudget_importer/src/models/actualbudget_category.rs +++ /dev/null @@ -1,8 +0,0 @@ -use diesel::{prelude::Queryable, Selectable}; - -#[derive(Queryable, Selectable)] -#[diesel(table_name = crate::schema::categories)] -pub struct ActualbudgetCategory { - pub id: String, - pub name: String, -} diff --git a/backend/actualbudget_importer/src/models/actualbudget_date.rs b/backend/actualbudget_importer/src/models/actualbudget_date.rs deleted file mode 100644 index bef160c..0000000 --- a/backend/actualbudget_importer/src/models/actualbudget_date.rs +++ /dev/null @@ -1,75 +0,0 @@ -use diesel::{backend::Backend, deserialize::{FromSql, FromSqlRow}, expression::AsExpression, sql_types::Integer, sqlite::Sqlite}; - -#[derive(Clone, PartialEq, Eq, Debug, AsExpression, FromSqlRow)] -#[diesel(sql_type=Integer)] -pub struct ActualbudgetDate(i32); - -#[derive(Clone, PartialOrd, PartialEq, Eq)] -enum DatePart { - MonthOfYear, - DayOfMonth, -} - -// actualbudget represents dates as numbers which "look like" the corresponding -// ISO string when written in decimal. E.g. 20240901 represents 1 Sep 2024. It -// also uses month specifiers, e.g. 202409 to represent Sep 2024. In this case, -// we interpret this as the first day of the month, e.g. 2024-09-01. - -impl ActualbudgetDate { - pub fn to_iso(&self) -> String { - format!("{0}-{1}-{2}", self.year(), self.month(), self.day()) - } - - pub fn year(&self) -> String { - self.0.to_string()[0..4].to_string() - } - - pub fn month(&self) -> String { - self.0.to_string()[4..6].to_string() - } - - pub fn day(&self) -> String { - match self.date_part() { - DatePart::DayOfMonth => self.0.to_string()[6..8].to_string(), - DatePart::MonthOfYear => String::from("01"), - } - } - - pub fn from_i32(i: i32) -> Self { - ActualbudgetDate(i) - } - - fn date_part(&self) -> DatePart { - if self.0 < 10000000 { - DatePart::MonthOfYear - } else { - DatePart::DayOfMonth - } - } - - fn dayified_value(&self) -> i32 { - match self.date_part() { - DatePart::DayOfMonth => self.0, - DatePart::MonthOfYear => self.0 * 100 + 1, - } - } -} - -impl Ord for ActualbudgetDate { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.dayified_value().cmp(&other.dayified_value()) - } -} - -impl PartialOrd for ActualbudgetDate { - fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { - Some(self.cmp(other)) - } -} - -impl FromSql<Integer, Sqlite> for ActualbudgetDate { - fn from_sql(bytes: <Sqlite as Backend>::RawValue<'_>) -> diesel::deserialize::Result<Self> { - let int: i32 = FromSql::<Integer, Sqlite>::from_sql(bytes)?; - Ok(ActualbudgetDate(int)) - } -} diff --git a/backend/actualbudget_importer/src/models/actualbudget_transaction.rs b/backend/actualbudget_importer/src/models/actualbudget_transaction.rs deleted file mode 100644 index be2ca1a..0000000 --- a/backend/actualbudget_importer/src/models/actualbudget_transaction.rs +++ /dev/null @@ -1,18 +0,0 @@ -use diesel::prelude::{Identifiable, Queryable, QueryableByName, Selectable}; - -use crate::models::actualbudget_date::ActualbudgetDate; - -#[derive(Identifiable, QueryableByName, Queryable, Selectable, Clone)] -#[diesel(table_name = crate::schema::transactions)] -pub struct ActualbudgetTransaction { - pub id: String, - pub is_parent: bool, - pub is_child: bool, - pub account_id: String, - pub category_id: String, - pub amount: i32, - pub payee: String, - pub notes: String, - pub date: ActualbudgetDate, - pub parent_id: Option<String>, -} diff --git a/backend/actualbudget_importer/src/models/actualbudget_zero_budget.rs b/backend/actualbudget_importer/src/models/actualbudget_zero_budget.rs deleted file mode 100644 index 6478d34..0000000 --- a/backend/actualbudget_importer/src/models/actualbudget_zero_budget.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::models::actualbudget_date::ActualbudgetDate; -use diesel::{prelude::{Identifiable, Queryable, QueryableByName, Selectable}, sqlite::Sqlite}; - -#[derive(Identifiable, QueryableByName, Queryable, Selectable, Clone)] -#[diesel(table_name = crate::schema::zero_budgets)] -#[diesel(check_for_backend(Sqlite))] -pub struct ActualbudgetZeroBudget { - pub id: String, - pub month: ActualbudgetDate, - pub category_id: String, - pub amount: i32, - pub do_carry_over: i32, -} diff --git a/backend/actualbudget_importer/src/models/mod.rs b/backend/actualbudget_importer/src/models/mod.rs deleted file mode 100644 index 1c97c65..0000000 --- a/backend/actualbudget_importer/src/models/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod actualbudget_account; -pub mod actualbudget_category; -pub mod actualbudget_date; -pub mod actualbudget_transaction; -pub mod actualbudget_zero_budget; diff --git a/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_all.rs b/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_all.rs deleted file mode 100644 index 6f667de..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_all.rs +++ /dev/null @@ -1,6 +0,0 @@ -use crate::{models::actualbudget_account::ActualbudgetAccount, schema::accounts::dsl::accounts}; -use diesel::{result::Error, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_actualbudget_accounts(connection: &mut SqliteConnection) -> Result<Vec<ActualbudgetAccount>, Error> { - accounts.select(ActualbudgetAccount::as_select()).load(connection) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_category_transfers_account.rs b/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_category_transfers_account.rs deleted file mode 100644 index f05dc78..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_accounts/get_category_transfers_account.rs +++ /dev/null @@ -1,13 +0,0 @@ -use diesel::{result::Error, ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -use crate::{models::actualbudget_account::ActualbudgetAccount, schema::accounts::{ - self as accounts_schema, - dsl::accounts as accounts_table, -}}; - -pub fn get_category_transfers_account(connection: &mut SqliteConnection) -> Result<ActualbudgetAccount, Error> { - accounts_table - .filter(accounts_schema::name.eq("Category transfers")) - .select(ActualbudgetAccount::as_select()) - .first(connection) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_accounts/mod.rs b/backend/actualbudget_importer/src/queries/actualbudget_accounts/mod.rs deleted file mode 100644 index c6d6015..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_accounts/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod get_all; -mod get_category_transfers_account; - -pub use get_all::get_all_actualbudget_accounts; -pub use get_category_transfers_account::get_category_transfers_account; diff --git a/backend/actualbudget_importer/src/queries/actualbudget_categories/get_all.rs b/backend/actualbudget_importer/src/queries/actualbudget_categories/get_all.rs deleted file mode 100644 index 4cb7ebc..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_categories/get_all.rs +++ /dev/null @@ -1,6 +0,0 @@ -use crate::{models::actualbudget_category::ActualbudgetCategory, schema::categories::dsl::categories}; -use diesel::{result::Error, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_actualbudget_categories(connection: &mut SqliteConnection) -> Result<Vec<ActualbudgetCategory>, Error> { - categories.select(ActualbudgetCategory::as_select()).load(connection) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_categories/mod.rs b/backend/actualbudget_importer/src/queries/actualbudget_categories/mod.rs deleted file mode 100644 index 0c04e53..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_categories/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod get_all; - -pub use get_all::get_all_actualbudget_categories; diff --git a/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_all.rs b/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_all.rs deleted file mode 100644 index 84c8d08..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_all.rs +++ /dev/null @@ -1,6 +0,0 @@ -use crate::{models::actualbudget_transaction::ActualbudgetTransaction, schema::transactions::dsl::transactions}; -use diesel::{result::Error, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_actualbudget_transactions(connection: &mut SqliteConnection) -> Result<Vec<ActualbudgetTransaction>, Error> { - transactions.select(ActualbudgetTransaction::as_select()).load(connection) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_first_date.rs b/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_first_date.rs deleted file mode 100644 index b958c37..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_transactions/get_first_date.rs +++ /dev/null @@ -1,14 +0,0 @@ -use anyhow::Result; -use crate::{models::actualbudget_date::ActualbudgetDate, schema::transactions::{ - self as transactions_schema, - dsl::transactions as transactions_table, -}}; -use diesel::{dsl::min, result::Error, QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn get_first_actualbudget_transaction_date(connection: &mut SqliteConnection) -> Result<ActualbudgetDate> { - let date_as_int = transactions_table - .select(min(transactions_schema::date)) - .first::<Option<i32>>(connection) - .map_or_else(|e| Err(e), |o| o.map_or_else(|| Err(Error::NotFound), |i| Ok(i)))?; - Ok(ActualbudgetDate::from_i32(date_as_int)) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_transactions/mod.rs b/backend/actualbudget_importer/src/queries/actualbudget_transactions/mod.rs deleted file mode 100644 index b4ed0dd..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_transactions/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod get_all; -mod get_first_date; - -pub use get_all::get_all_actualbudget_transactions; -pub use get_first_date::get_first_actualbudget_transaction_date; diff --git a/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/get_all.rs b/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/get_all.rs deleted file mode 100644 index 0c3f695..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/get_all.rs +++ /dev/null @@ -1,6 +0,0 @@ -use crate::{models::actualbudget_zero_budget::ActualbudgetZeroBudget, schema::zero_budgets::dsl::zero_budgets}; -use diesel::{result::Error, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_actualbudget_zero_budgets(connection: &mut SqliteConnection) -> Result<Vec<ActualbudgetZeroBudget>, Error> { - zero_budgets.select(ActualbudgetZeroBudget::as_select()).load(connection) -} diff --git a/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/mod.rs b/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/mod.rs deleted file mode 100644 index ba7e21b..0000000 --- a/backend/actualbudget_importer/src/queries/actualbudget_zero_budgets/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod get_all; - -pub use get_all::get_all_actualbudget_zero_budgets; diff --git a/backend/actualbudget_importer/src/queries/mod.rs b/backend/actualbudget_importer/src/queries/mod.rs deleted file mode 100644 index e16dafc..0000000 --- a/backend/actualbudget_importer/src/queries/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod actualbudget_accounts; -pub mod actualbudget_categories; -pub mod actualbudget_transactions; -pub mod actualbudget_zero_budgets; diff --git a/backend/actualbudget_importer/src/schema.rs b/backend/actualbudget_importer/src/schema.rs deleted file mode 100644 index a872231..0000000 --- a/backend/actualbudget_importer/src/schema.rs +++ /dev/null @@ -1,47 +0,0 @@ -diesel::table! { - accounts (id) { - id -> Text, - name -> Text, - } -} - -diesel::table! { - categories (id) { - id -> Text, - name -> Text, - } -} - -diesel::table! { - transactions (id) { - id -> Text, - #[sql_name = "isParent"] - is_parent -> Bool, - #[sql_name = "isChild"] - is_child -> Bool, - #[sql_name = "acct"] - account_id -> Text, - #[sql_name = "category"] - category_id -> Text, - amount -> Integer, - #[sql_name = "description"] - payee -> Text, - notes -> Text, - date -> Integer, - parent_id -> Nullable<Text>, - } -} - -diesel::table! { - zero_budgets (id) { - id -> Text, - month -> Integer, - #[sql_name = "category"] - category_id -> Text, - amount -> Integer, - #[sql_name = "carryover"] - do_carry_over -> Integer, - // goal -> Integer, - // long_goal -> Integer, - } -} diff --git a/backend/actualbudget_importer/src/transformers.rs b/backend/actualbudget_importer/src/transformers.rs deleted file mode 100644 index dd4d154..0000000 --- a/backend/actualbudget_importer/src/transformers.rs +++ /dev/null @@ -1,218 +0,0 @@ -use anyhow::Result; -use budgeting_app_core::models::{ - account::Account, budget_update::BudgetUpdate, category::Category, category_transfer::CategoryTransfer, date_utc::DateUtc, datetime_utc::DatetimeUtc, transaction::Transaction, transaction_categorisation::TransactionCategorisation -}; -use core::panic; -use std::hash::{DefaultHasher, Hash, Hasher}; - -use crate::models::{actualbudget_account::ActualbudgetAccount, actualbudget_category::ActualbudgetCategory, actualbudget_date::ActualbudgetDate, actualbudget_transaction::ActualbudgetTransaction, actualbudget_zero_budget::ActualbudgetZeroBudget}; - -pub fn transform_date(actualbudget_date: &ActualbudgetDate) -> Result<DatetimeUtc> { - actualbudget_date.to_iso().parse() -} - -pub fn transform_accounts( - actualbudget_accounts: &[ActualbudgetAccount], - first_transaction_date: &DatetimeUtc, -) -> Vec<Account> { - let mut accounts = Vec::<Account>::new(); - for account in actualbudget_accounts { - accounts.push(transform_account(account, first_transaction_date)); - } - accounts -} - -fn transform_account( - actualbudget_account: &ActualbudgetAccount, - opening_date: &DatetimeUtc, -) -> Account { - Account { - id: transform_id(&actualbudget_account.id.clone()), - name: actualbudget_account.name.clone(), - opening_balance: 0, - opening_date: opening_date.clone(), - } -} - -pub fn transform_categories( - actualbudget_categories: &[ActualbudgetCategory], -) -> Vec<Category> { - let mut categories = Vec::<Category>::new(); - for actualbudget_category in actualbudget_categories { - categories.push(Category { - id: transform_id(&actualbudget_category.id.clone()), - name: actualbudget_category.name.clone(), - }) - } - categories -} - -fn transform_id(actualbudget_id: &str) -> i32 { - let mut hasher = DefaultHasher::new(); - actualbudget_id.hash(&mut hasher); - (hasher.finish() % std::convert::TryInto::<u64>::try_into(i32::MAX).unwrap()) - .try_into() - .unwrap() -} - -pub fn transform_budget_updates( - actualbudget_zero_budgets: &[ActualbudgetZeroBudget], -) -> Result<Vec<BudgetUpdate>> { - let mut budget_updates = Vec::<BudgetUpdate>::new(); - for zero_budget in actualbudget_zero_budgets { - let first_zero_budget_in_category = get_first_zero_budget_in_category( - actualbudget_zero_budgets, - &zero_budget.category_id.clone(), - ); - if first_zero_budget_in_category.is_some_and(|zb| zb.id == zero_budget.id) { - continue; - } - budget_updates.push(BudgetUpdate { - id: transform_id(&zero_budget.id.clone()), - category_id: transform_id(&zero_budget.category_id.clone()), - date: DateUtc::from(transform_date(&zero_budget.month.clone())?), - new_budget: zero_budget.amount.try_into().unwrap(), - new_period: 30, - }) - } - Ok(budget_updates) -} - -fn get_first_zero_budget_in_category( - actualbudget_zero_budgets: &[ActualbudgetZeroBudget], - actualbudget_category_id: &str, -) -> Option<ActualbudgetZeroBudget> { - let mut category_zero_budgets = actualbudget_zero_budgets.to_vec(); - category_zero_budgets.retain(|zb| zb.category_id == actualbudget_category_id); - category_zero_budgets - .iter() - .min_by_key(|zb| zb.month.clone()) - .cloned() -} - -pub fn transform_transactions( - actualbudget_transactions: &[ActualbudgetTransaction], - actualbudget_category_transfers_account: &ActualbudgetAccount, -) -> Result<(Vec<Transaction>, Vec<TransactionCategorisation>)> { - let mut transactions = Vec::<Transaction>::new(); - let mut transaction_categorisations = Vec::<TransactionCategorisation>::new(); - - let mut actualbudget_transactions = actualbudget_transactions.to_vec(); - actualbudget_transactions - .retain(|t| t.category_id.clone() != actualbudget_category_transfers_account.id.clone()); - let mut parent_actualbudget_transactions = actualbudget_transactions.to_vec(); - parent_actualbudget_transactions.retain(|t| t.is_parent); - let mut child_actualbudget_transactions = actualbudget_transactions.to_vec(); - child_actualbudget_transactions.retain(|t| t.is_child); - let mut atomic_actualbudget_transactions = actualbudget_transactions.to_vec(); - atomic_actualbudget_transactions.retain(|t| !t.is_parent && !t.is_child); - - for atomic_actualbudget_transaction in atomic_actualbudget_transactions { - let transaction_id = transform_id(&atomic_actualbudget_transaction.id); - - transactions.push(Transaction { - id: transaction_id, - description: atomic_actualbudget_transaction.notes, - payee: atomic_actualbudget_transaction.payee, - quantity: atomic_actualbudget_transaction.amount.try_into().unwrap(), - date: transform_date(&atomic_actualbudget_transaction.date)?, - account_id: transform_id(&atomic_actualbudget_transaction.account_id), - }); - - transaction_categorisations.push(TransactionCategorisation { - id: transaction_id, - description: String::new(), - quantity: atomic_actualbudget_transaction.amount.try_into().unwrap(), - transaction_id, - category_id: transform_id(&atomic_actualbudget_transaction.category_id), - }); - } - - for parent_actualbudget_transaction in parent_actualbudget_transactions { - let mut child_actualbudget_transactions = child_actualbudget_transactions.to_vec(); - child_actualbudget_transactions.retain(|t| { - t.parent_id - .clone() - .is_some_and(|parent_id| parent_id == parent_actualbudget_transaction.id.clone()) - }); - - let transaction_id = transform_id(&parent_actualbudget_transaction.id); - - transactions.push(Transaction { - id: transaction_id, - description: parent_actualbudget_transaction.notes, - payee: parent_actualbudget_transaction.payee, - quantity: parent_actualbudget_transaction.amount.try_into().unwrap(), - date: transform_date(&parent_actualbudget_transaction.date)?, - account_id: transform_id(&parent_actualbudget_transaction.account_id), - }); - - for child_actualbudget_transaction in child_actualbudget_transactions { - transaction_categorisations.push(TransactionCategorisation { - id: transform_id(&child_actualbudget_transaction.id), - description: child_actualbudget_transaction.notes, - quantity: child_actualbudget_transaction.amount.try_into().unwrap(), - transaction_id, - category_id: transform_id(&child_actualbudget_transaction.category_id), - }); - } - } - - Ok((transactions, transaction_categorisations)) -} - -pub fn transform_category_transfers( - actualbudget_transactions: &[ActualbudgetTransaction], - actualbudget_category_transfers_account: &ActualbudgetAccount, -) -> Vec<CategoryTransfer> { - let mut category_transfers = Vec::<CategoryTransfer>::new(); - - let mut actualbudget_category_transfers = actualbudget_transactions.to_vec(); - actualbudget_category_transfers - .retain(|t| t.category_id.clone() == actualbudget_category_transfers_account.id.clone()); - let mut actualbudget_parent_category_transfers = actualbudget_category_transfers.to_vec(); - actualbudget_parent_category_transfers.retain(|t| t.is_parent); - let mut actualbudget_child_category_transfers = actualbudget_category_transfers.to_vec(); - actualbudget_child_category_transfers.retain(|t| t.is_child); - - for actualbudget_parent_category_transfer in actualbudget_parent_category_transfers { - let mut actualbudget_child_category_transfers = - actualbudget_child_category_transfers.to_vec(); - actualbudget_child_category_transfers.retain(|t| { - t.parent_id - .clone() - .is_some_and(|parent_id| parent_id == actualbudget_parent_category_transfer.id) - }); - - if actualbudget_child_category_transfers.len() != 2 { - panic!("Category transfers should always have exactly two children."); - } - - let category_1 = actualbudget_child_category_transfers[0].clone(); - let category_2 = actualbudget_child_category_transfers[1].clone(); - - // To avoid duplicates - if category_1.amount >= 0 { - continue; - } - - if actualbudget_child_category_transfers[0].amount - != -actualbudget_child_category_transfers[1].amount - { - panic!("Category transfer children should sum to zero."); - } - - category_transfers.push(CategoryTransfer { - id: transform_id(&actualbudget_parent_category_transfer.id), - description: actualbudget_parent_category_transfer.notes, - quantity: actualbudget_child_category_transfers[0] - .amount - .try_into() - .unwrap(), - from_category_id: transform_id(&category_1.id), - to_category_id: transform_id(&category_2.id), - }); - } - - category_transfers -} diff --git a/backend/app/Cargo.lock b/backend/app/Cargo.lock deleted file mode 100644 index 0f6e6d4..0000000 --- a/backend/app/Cargo.lock +++ /dev/null @@ -1,2021 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atomic" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" - -[[package]] -name = "atomic" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "budgeting_app_backend" -version = "0.1.0" -dependencies = [ - "budgeting_app_core", - "cfg-if", - "chrono", - "diesel", - "diesel_migrations", - "dotenvy", - "rocket", - "rocket_sync_db_pools", - "rusqlite", -] - -[[package]] -name = "budgeting_app_core" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "diesel_migrations", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "bytemuck" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" - -[[package]] -name = "cc" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets 0.52.6", -] - -[[package]] -name = "cookie" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "devise" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d90b0c4c777a2cad215e3c7be59ac7c15adf45cf76317009b7d096d46f651d" -dependencies = [ - "devise_codegen", - "devise_core", -] - -[[package]] -name = "devise_codegen" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b28680d8be17a570a2334922518be6adc3f58ecc880cbb404eaeb8624fd867" -dependencies = [ - "devise_core", - "quote", -] - -[[package]] -name = "devise_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b035a542cf7abf01f2e3c4d5a7acbaebfefe120ae4efc7bde3df98186e4b8af7" -dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", -] - -[[package]] -name = "diesel" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e13bab2796f412722112327f3e575601a3e9cdcbe426f0d30dbf43f3f5dc71" -dependencies = [ - "diesel_derives", - "libsqlite3-sys", - "r2d2", - "time", -] - -[[package]] -name = "diesel_derives" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" -dependencies = [ - "diesel_table_macro_syntax", - "dsl_auto_type", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel_migrations" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a73ce704bad4231f001bff3314d91dce4aba0770cee8b233991859abc15c1f6" -dependencies = [ - "diesel", - "migrations_internals", - "migrations_macros", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" -dependencies = [ - "syn", -] - -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - -[[package]] -name = "dsl_auto_type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" -dependencies = [ - "darling", - "either", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - -[[package]] -name = "fastrand" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" - -[[package]] -name = "figment" -version = "0.10.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" -dependencies = [ - "atomic 0.6.0", - "pear", - "serde", - "toml", - "uncased", - "version_check", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashlink" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "inlinable_string" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" - -[[package]] -name = "is-terminal" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "serde", - "serde_json", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "migrations_internals" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd01039851e82f8799046eabbb354056283fb265c8ec0996af940f4e85a380ff" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "migrations_macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb161cc72176cb37aa47f1fc520d3ef02263d67d661f44f05d05a079e1237fd" -dependencies = [ - "migrations_internals", - "proc-macro2", - "quote", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "wasi", - "windows-sys 0.52.0", -] - -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 1.1.0", - "httparse", - "memchr", - "mime", - "spin", - "tokio", - "tokio-util", - "version_check", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "pear" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" -dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi", -] - -[[package]] -name = "pear_codegen" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" -dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "regex" -version = "1.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "rocket" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a516907296a31df7dc04310e7043b61d71954d703b603cc6867a026d7e72d73f" -dependencies = [ - "async-stream", - "async-trait", - "atomic 0.5.3", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "log", - "memchr", - "multer", - "num_cpus", - "parking_lot", - "pin-project-lite", - "rand", - "ref-cast", - "rocket_codegen", - "rocket_http", - "serde", - "serde_json", - "state", - "tempfile", - "time", - "tokio", - "tokio-stream", - "tokio-util", - "ubyte", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_codegen" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46" -dependencies = [ - "devise", - "glob", - "indexmap", - "proc-macro2", - "quote", - "rocket_http", - "syn", - "unicode-xid", - "version_check", -] - -[[package]] -name = "rocket_http" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e274915a20ee3065f611c044bd63c40757396b6dbc057d6046aec27f14f882b9" -dependencies = [ - "cookie", - "either", - "futures", - "http 0.2.12", - "hyper", - "indexmap", - "log", - "memchr", - "pear", - "percent-encoding", - "pin-project-lite", - "ref-cast", - "serde", - "smallvec", - "stable-pattern", - "state", - "time", - "tokio", - "uncased", -] - -[[package]] -name = "rocket_sync_db_pools" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f32721ed79509adac4328e97f817a8f55a47c4b64799f6fd6cc3adb6e42ff" -dependencies = [ - "diesel", - "r2d2", - "rocket", - "rocket_sync_db_pools_codegen", - "serde", - "tokio", - "version_check", -] - -[[package]] -name = "rocket_sync_db_pools_codegen" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc890925dc79370c28eb15c9957677093fdb7e8c44966d189f38cedb995ee68" -dependencies = [ - "devise", - "quote", -] - -[[package]] -name = "rusqlite" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" -dependencies = [ - "bitflags", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustix" -version = "0.38.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.209" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.209" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "stable-pattern" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" -dependencies = [ - "memchr", -] - -[[package]] -name = "state" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" -dependencies = [ - "loom", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tokio" -version = "1.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "ubyte" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f720def6ce1ee2fc44d40ac9ed6d3a59c361c80a75a7aa8e75bb9baed31cf2ea" -dependencies = [ - "serde", -] - -[[package]] -name = "uncased" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "serde", - "version_check", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-xid" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" - -[[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-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -dependencies = [ - "is-terminal", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/backend/app/Cargo.toml b/backend/app/Cargo.toml deleted file mode 100644 index efb8280..0000000 --- a/backend/app/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "budgeting_app_backend" -version = "0.1.0" -edition = "2021" - -[dependencies] -budgeting_app_core = { path = "../core" } -chrono = { workspace = true, features = ["serde"] } -cfg-if = { workspace = true } -diesel = { workspace = true, features = ["sqlite"] } -diesel_migrations = { workspace = true } -dotenvy = { workspace = true } -rocket = { workspace = true, features = ["json"] } -rocket_sync_db_pools = { workspace = true, features = ["diesel_sqlite_pool"] } -rusqlite = { workspace = true, features = ["bundled"] } diff --git a/backend/app/Rocket.toml b/backend/app/Rocket.toml deleted file mode 100644 index 088d632..0000000 --- a/backend/app/Rocket.toml +++ /dev/null @@ -1,2 +0,0 @@ -[global.databases] -user_data = { url = "/home/joeac/src/budgeting-app/backend/core/user_data.sqlite" } diff --git a/backend/app/diesel.toml b/backend/app/diesel.toml deleted file mode 100644 index a0d61bf..0000000 --- a/backend/app/diesel.toml +++ /dev/null @@ -1,9 +0,0 @@ -# For documentation on how to configure this file, -# see https://diesel.rs/guides/configuring-diesel-cli - -[print_schema] -file = "src/schema.rs" -custom_type_derives = ["diesel::query_builder::QueryId", "Clone"] - -[migrations_directory] -dir = "migrations" diff --git a/backend/app/src/databases.rs b/backend/app/src/databases.rs deleted file mode 100644 index 7202e78..0000000 --- a/backend/app/src/databases.rs +++ /dev/null @@ -1,11 +0,0 @@ -use rocket_sync_db_pools::{database, diesel}; - -cfg_if::cfg_if! { - if #[cfg(test)] { - #[database("user_data.test")] - pub struct UserDataDb(diesel::SqliteConnection); - } else { - #[database("user_data")] - pub struct UserDataDb(diesel::SqliteConnection); - } -} diff --git a/backend/app/src/main.rs b/backend/app/src/main.rs deleted file mode 100644 index dca6096..0000000 --- a/backend/app/src/main.rs +++ /dev/null @@ -1,51 +0,0 @@ -use budgeting_app_core::MIGRATIONS; -use diesel::SqliteConnection; -use diesel_migrations::MigrationHarness; -use rocket::fairing::AdHoc; -use rocket::http::ContentType; -use rocket::{launch, routes, Build, Rocket}; - -use crate::databases::UserDataDb; - -pub mod databases; -pub mod routes; - -fn run_database_migrations(connection: &mut SqliteConnection) { - connection - .run_pending_migrations(MIGRATIONS) - .expect("Error running database migrations"); -} - -#[launch] -async fn rocket() -> Rocket<Build> { - rocket::build() - .attach(UserDataDb::fairing()) - .attach(AdHoc::on_liftoff("Database Migration", |rocket| { - Box::pin(async move { - let user_data_db = UserDataDb::get_one(rocket).await.expect( - "Failed to get connection to user data database in order to run migrations", - ); - user_data_db.run(run_database_migrations).await; - }) - })) - .attach(AdHoc::on_response("Add CORS headers", |_req, res| { - Box::pin(async move { - res.set_header(ContentType::JSON); - res.set_header(rocket::http::Header::new( - "Access-Control-Allow-Origin", - "http://localhost:5173", - )); - }) - })) - .mount( - "/", - routes![ - routes::account::get_all_accounts, - routes::account::create_account, - routes::balance::get_all_category_balances, - routes::budget::get_current_category_budget_per_category, - routes::budget_update::get_all_budget_updates, - routes::category::get_all_categories, - ], - ) -} diff --git a/backend/app/src/routes/account.rs b/backend/app/src/routes/account.rs deleted file mode 100644 index 96f1f38..0000000 --- a/backend/app/src/routes/account.rs +++ /dev/null @@ -1,50 +0,0 @@ -use budgeting_app_core::{ - models::account::Account, - queries::accounts::{get_all_accounts as get_all_accounts_query, insert_accounts}, -}; -use rocket::http::Status; -use rocket::serde::json::Json; -use rocket::{get, post, Responder}; - -use crate::databases::UserDataDb; - -#[get("/account")] -pub async fn get_all_accounts(user_data_db: UserDataDb) -> Result<Json<Vec<Account>>, (Status, String)> { - user_data_db - .run(get_all_accounts_query) - .await - .map(Json) - .map_err(|err| (Status::InternalServerError, err.to_string())) -} - -#[derive(Responder)] -pub enum CreateAccountResponder { - #[response(status = 500, content_type = "text")] - InternalServerError(String), - - #[response(status = 202, content_type = "json")] - Created(Json<Account>), - - #[response(status = 400, content_type = "text")] - BadRequest(String), -} - -#[post("/account", data = "<account>", format = "json")] -pub async fn create_account( - account: Json<Account>, - user_data_db: UserDataDb, -) -> CreateAccountResponder { - let account = account.into_inner(); - let accounts_vec = vec![account.clone()]; - - let num_rows_inserted = user_data_db - .run(move |connection| insert_accounts(&accounts_vec, connection)) - .await; - - match num_rows_inserted { - Ok(_) => CreateAccountResponder::Created(Json(account)), - Err(err) => CreateAccountResponder::InternalServerError(format!( - "Error creating account: {err}" - )), - } -} diff --git a/backend/app/src/routes/balance.rs b/backend/app/src/routes/balance.rs deleted file mode 100644 index 21adb3b..0000000 --- a/backend/app/src/routes/balance.rs +++ /dev/null @@ -1,17 +0,0 @@ -use budgeting_app_core::{ - models::category_balance::CategoryBalance, - queries::categories::get_all_category_balances as get_all_category_balances_query, -}; -use rocket::{get, http::Status, serde::json::Json}; - -use crate::databases::UserDataDb; -#[get("/balance/category")] -pub async fn get_all_category_balances( - user_data_db: UserDataDb, -) -> Result<Json<Vec<CategoryBalance>>, Status> { - user_data_db - .run(get_all_category_balances_query) - .await - .map(Json) - .map_err(|_| Status { code: 500 }) -} diff --git a/backend/app/src/routes/budget.rs b/backend/app/src/routes/budget.rs deleted file mode 100644 index dc0802a..0000000 --- a/backend/app/src/routes/budget.rs +++ /dev/null @@ -1,20 +0,0 @@ -use budgeting_app_core::{ - models::category_budget::CategoryBudget, - queries::categories::get_most_recent_category_budget_per_category_id as get_most_recent_category_budget_per_category_id_query, -}; -use rocket::get; -use rocket::http::Status; -use rocket::serde::json::Json; - -use crate::databases::UserDataDb; - -#[get("/budget/category?current")] -pub async fn get_current_category_budget_per_category( - user_data_db: UserDataDb, -) -> Result<Json<Vec<CategoryBudget>>, Status> { - user_data_db - .run(get_most_recent_category_budget_per_category_id_query) - .await - .map(Json) - .map_err(|_| Status { code: 500 }) -} diff --git a/backend/app/src/routes/budget_update.rs b/backend/app/src/routes/budget_update.rs deleted file mode 100644 index 86dda9f..0000000 --- a/backend/app/src/routes/budget_update.rs +++ /dev/null @@ -1,20 +0,0 @@ -use budgeting_app_core::{ - models::budget_update::BudgetUpdate, - queries::budget_updates::get_all_budget_updates as get_all_budget_updates_query, -}; -use rocket::get; -use rocket::http::Status; -use rocket::serde::json::Json; - -use crate::databases::UserDataDb; - -#[get("/budget-update")] -pub async fn get_all_budget_updates( - user_data_db: UserDataDb, -) -> Result<Json<Vec<BudgetUpdate>>, Status> { - user_data_db - .run(get_all_budget_updates_query) - .await - .map(Json) - .map_err(|_| Status { code: 500 }) -} diff --git a/backend/app/src/routes/category.rs b/backend/app/src/routes/category.rs deleted file mode 100644 index ca021fc..0000000 --- a/backend/app/src/routes/category.rs +++ /dev/null @@ -1,18 +0,0 @@ -use budgeting_app_core::{ - models::category::Category, - queries::categories::get_all_categories as get_all_categories_query, -}; -use rocket::get; -use rocket::http::Status; -use rocket::serde::json::Json; - -use crate::databases::UserDataDb; - -#[get("/category")] -pub async fn get_all_categories(user_data_db: UserDataDb) -> Result<Json<Vec<Category>>, Status> { - user_data_db - .run(get_all_categories_query) - .await - .map(Json) - .map_err(|_| Status { code: 500 }) -} diff --git a/backend/app/src/routes/mod.rs b/backend/app/src/routes/mod.rs deleted file mode 100644 index bf0ab4a..0000000 --- a/backend/app/src/routes/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod account; -pub mod balance; -pub mod budget; -pub mod budget_update; -pub mod category; diff --git a/backend/core/Cargo.lock b/backend/core/Cargo.lock deleted file mode 100644 index 649a043..0000000 --- a/backend/core/Cargo.lock +++ /dev/null @@ -1,669 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "budgeting_app_core" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "derive_builder", - "diesel", - "diesel_migrations", - "libsqlite3-sys", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cc" -version = "1.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_builder" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_macro" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" -dependencies = [ - "derive_builder_core", - "syn", -] - -[[package]] -name = "diesel" -version = "2.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e" -dependencies = [ - "diesel_derives", - "libsqlite3-sys", - "time", -] - -[[package]] -name = "diesel_derives" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" -dependencies = [ - "diesel_table_macro_syntax", - "dsl_auto_type", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel_migrations" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a73ce704bad4231f001bff3314d91dce4aba0770cee8b233991859abc15c1f6" -dependencies = [ - "diesel", - "migrations_internals", - "migrations_macros", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" -dependencies = [ - "syn", -] - -[[package]] -name = "dsl_auto_type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" -dependencies = [ - "darling", - "either", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "hashbrown" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.159" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" - -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "migrations_internals" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd01039851e82f8799046eabbb354056283fb265c8ec0996af940f4e85a380ff" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "migrations_macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb161cc72176cb37aa47f1fc520d3ef02263d67d661f44f05d05a079e1237fd" -dependencies = [ - "migrations_internals", - "proc-macro2", - "quote", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "wasm-bindgen" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] diff --git a/backend/core/Cargo.toml b/backend/core/Cargo.toml deleted file mode 100644 index d40690e..0000000 --- a/backend/core/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "budgeting_app_core" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow = { workspace = true } -chrono = { workspace = true, features = ["serde"] } -derive_builder = { workspace = true } -diesel = { workspace = true, features = ["sqlite"] } -diesel_migrations = { workspace = true } -serde = { workspace = true, features = ["derive"] } - -[dev-dependencies] -libsqlite3-sys = { workspace = true, features = ["bundled"] } diff --git a/backend/core/migrations/2024-08-31-084439_initial_setup/down.sql b/backend/core/migrations/2024-08-31-084439_initial_setup/down.sql deleted file mode 100644 index 8cf4b1e..0000000 --- a/backend/core/migrations/2024-08-31-084439_initial_setup/down.sql +++ /dev/null @@ -1,6 +0,0 @@ -DROP TABLE accounts; -DROP TABLE budget_updates; -DROP TABLE categories; -DROP TABLE transaction_categorisations; -DROP TABLE category_transfers; -DROP TABLE transactions; diff --git a/backend/core/migrations/2024-08-31-084439_initial_setup/up.sql b/backend/core/migrations/2024-08-31-084439_initial_setup/up.sql deleted file mode 100644 index 9038b54..0000000 --- a/backend/core/migrations/2024-08-31-084439_initial_setup/up.sql +++ /dev/null @@ -1,71 +0,0 @@ -PRAGMA foreign_keys = ON; - -CREATE TABLE accounts( - id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - opening_balance INTEGER NOT NULL, - opening_date TEXT NOT NULL -); - -CREATE TABLE budget_updates( - id INTEGER NOT NULL PRIMARY KEY, - category_id INTEGER NOT NULL, - date TEXT NOT NULL, - new_budget INTEGER NOT NULL, - new_period INTEGER NOT NULL, - UNIQUE (category_id, date), - FOREIGN KEY (category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); - -CREATE TABLE categories( - id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL -); - -CREATE TABLE category_transfers( - id INTEGER NOT NULL PRIMARY KEY, - description TEXT NOT NULL, - quantity INTEGER NOT NULL, - from_category_id INTEGER NOT NULL, - to_category_id INTEGER NOT NULL, - FOREIGN KEY (from_category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT, - FOREIGN KEY (to_category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); - -CREATE TABLE transactions( - id INTEGER NOT NULL PRIMARY KEY, - description TEXT NOT NULL, - payee TEXT NOT NULL, - quantity INTEGER NOT NULL, - date TEXT NOT NULL, - account_id INTEGER NOT NULL, - FOREIGN KEY (account_id) - REFERENCES accounts (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); - -CREATE TABLE transaction_categorisations( - id INTEGER NOT NULL PRIMARY KEY, - description TEXT NOT NULL, - quantity INTEGER NOT NULL, - transaction_id INTEGER NOT NULL, - category_id INTEGER NOT NULL, - FOREIGN KEY (transaction_id) - REFERENCES transactions (id) - ON UPDATE CASCADE - ON DELETE RESTRICT, - FOREIGN KEY (category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); diff --git a/backend/core/src/lib.rs b/backend/core/src/lib.rs deleted file mode 100644 index fd56999..0000000 --- a/backend/core/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -use diesel_migrations::{embed_migrations, EmbeddedMigrations}; - -pub mod models; -pub mod queries; -pub mod schema; -pub mod traits; - -mod utils; - -pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations"); diff --git a/backend/core/src/models/account.rs b/backend/core/src/models/account.rs deleted file mode 100644 index 2df43e1..0000000 --- a/backend/core/src/models/account.rs +++ /dev/null @@ -1,15 +0,0 @@ -use diesel::prelude::*; -use serde::{Deserialize, Serialize}; - -use crate::models::datetime_utc::DatetimeUtc; - -#[derive( - Insertable, Queryable, Identifiable, Selectable, Debug, PartialEq, Clone, Serialize, Deserialize, -)] -#[diesel(table_name = crate::schema::accounts)] -pub struct Account { - pub id: i32, - pub name: String, - pub opening_balance: i32, - pub opening_date: DatetimeUtc, -} diff --git a/backend/core/src/models/budget.rs b/backend/core/src/models/budget.rs deleted file mode 100644 index e6fb4c9..0000000 --- a/backend/core/src/models/budget.rs +++ /dev/null @@ -1,42 +0,0 @@ -use serde::Serialize; - -use super::budget_update::BudgetUpdate; - -#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)] -pub struct Budget { - pub quantity: i32, - pub period: i32, -} - -impl From<&BudgetUpdate> for Budget { - fn from(budget_update: &BudgetUpdate) -> Self { - Self { - quantity: budget_update.new_budget, - period: budget_update.new_period, - } - } -} - -#[cfg(test)] -mod test { - use crate::{models::date_utc::DateUtc, traits::nowlike::Nowlike}; - - use super::*; - - #[test] - fn when_from_budget_update_then_returns_budget() { - let quantity = 2; - let period = 3; - let budget_update = BudgetUpdate { - id: 0, - category_id: 1, - date: DateUtc::now(), - new_budget: quantity, - new_period: period, - }; - - let budget = Budget::from(&budget_update); - - assert_eq!(budget, Budget { quantity, period }); - } -} diff --git a/backend/core/src/models/budget_update.rs b/backend/core/src/models/budget_update.rs deleted file mode 100644 index c7221b1..0000000 --- a/backend/core/src/models/budget_update.rs +++ /dev/null @@ -1,16 +0,0 @@ -use derive_builder::Builder; -use diesel::prelude::*; -use serde::Serialize; - -use crate::models::{category::Category, date_utc::DateUtc}; - -#[derive(Builder, Clone, Serialize, Queryable, Identifiable, Selectable, Associations, Debug, PartialEq, Eq, Insertable)] -#[diesel(table_name = crate::schema::budget_updates)] -#[diesel(belongs_to(Category))] -pub struct BudgetUpdate { - pub id: i32, - pub category_id: i32, - pub date: DateUtc, - pub new_budget: i32, - pub new_period: i32, -} diff --git a/backend/core/src/models/category.rs b/backend/core/src/models/category.rs deleted file mode 100644 index 55c7b97..0000000 --- a/backend/core/src/models/category.rs +++ /dev/null @@ -1,10 +0,0 @@ -use derive_builder::Builder; -use diesel::prelude::*; -use serde::{Deserialize, Serialize}; - -#[derive(Builder, Queryable, Identifiable, Selectable, Debug, PartialEq, Serialize, Deserialize, Insertable)] -#[diesel(table_name = crate::schema::categories)] -pub struct Category { - pub id: i32, - pub name: String, -} diff --git a/backend/core/src/models/category_balance.rs b/backend/core/src/models/category_balance.rs deleted file mode 100644 index 796b40b..0000000 --- a/backend/core/src/models/category_balance.rs +++ /dev/null @@ -1,7 +0,0 @@ -use serde::Serialize; - -#[derive(Serialize)] -pub struct CategoryBalance { - pub category_id: i32, - pub balance: i32, -} diff --git a/backend/core/src/models/category_budget.rs b/backend/core/src/models/category_budget.rs deleted file mode 100644 index 9796261..0000000 --- a/backend/core/src/models/category_budget.rs +++ /dev/null @@ -1,9 +0,0 @@ -use serde::Serialize; - -use super::budget::Budget; - -#[derive(Serialize)] -pub struct CategoryBudget { - pub category_id: i32, - pub budget: Option<Budget>, -} diff --git a/backend/core/src/models/category_transfer.rs b/backend/core/src/models/category_transfer.rs deleted file mode 100644 index 7b36054..0000000 --- a/backend/core/src/models/category_transfer.rs +++ /dev/null @@ -1,12 +0,0 @@ -use derive_builder::Builder; -use diesel::prelude::*; - -#[derive(Builder, Queryable, Identifiable, Selectable, Debug, PartialEq, Insertable)] -#[diesel(table_name = crate::schema::category_transfers)] -pub struct CategoryTransfer { - pub id: i32, - pub description: String, - pub quantity: i32, - pub from_category_id: i32, - pub to_category_id: i32, -} diff --git a/backend/core/src/models/date_utc.rs b/backend/core/src/models/date_utc.rs deleted file mode 100644 index 55d9e3f..0000000 --- a/backend/core/src/models/date_utc.rs +++ /dev/null @@ -1,309 +0,0 @@ -use std::{borrow::Borrow, fmt, str::FromStr}; - -use anyhow::{Context, Error, Result}; -use chrono::{DateTime, Datelike, NaiveDate, NaiveTime, Utc}; -use diesel::{ - backend::Backend, - deserialize::{self, FromSql, FromSqlRow}, - expression::AsExpression, - serialize::{self, ToSql}, - sql_types::Text, - sqlite::Sqlite, -}; -use serde::{Deserialize, Serialize}; - -use crate::traits::{dateable::Dateable, nowlike::Nowlike}; - -use super::datetime_utc::DatetimeUtc; - -#[derive( - Eq, - PartialEq, - Ord, - PartialOrd, - Serialize, - Deserialize, - Clone, - Debug, - AsExpression, - FromSqlRow, -)] -#[diesel(sql_type=Text)] -pub struct DateUtc { - chrono_datetime_utc: DateTime<Utc>, -} - -impl DateUtc { - pub fn from_ymd(year: i32, month: u32, day: u32) -> Result<Self> { - Ok(Self { - chrono_datetime_utc: NaiveDate::from_ymd_opt(year, month, day) - .with_context(|| format!("failed to construct date from ymd {:04}-{:02}-{:02}", year, month, day))? - .and_hms_opt(0, 0, 0).unwrap() - .and_utc() - }) - } - - pub fn with_hms(&mut self, hour: u32, min: u32, sec: u32) -> Result<DatetimeUtc> { - DatetimeUtc::from_ymd_and_hms( - self.year(), self.month(), self.day(), hour, min, sec, - ) - } - - pub fn day_diff(&self, other: &DateUtc) -> u32 { - self.chrono_datetime_utc - .num_days_from_ce() - .abs_diff(other.chrono_datetime_utc.num_days_from_ce()) - } - - fn is_day_str(str: &str) -> bool { - if str.len() != 10 { - return false; - } - for (ix, ch) in str.chars().enumerate() { - if ix == 4 || ix == 7 { - if ch != '-' { - return false; - } - } else { - if ch < '0' || ch > '9' { - return false; - } - } - } - return true; - } -} - -impl Nowlike for DateUtc { - fn now() -> Self { - let now = Utc::now(); - Self::from_ymd( - now.year(), - now.month(), - now.day(), - ).unwrap() - } -} - -impl Dateable for DateUtc { - fn year(&self) -> i32 { - self.chrono_datetime_utc.year() - } - - fn month(&self) -> u32 { - self.chrono_datetime_utc.month() - } - - fn day(&self) -> u32 { - self.chrono_datetime_utc.day() - } -} - -impl From<DatetimeUtc> for DateUtc { - fn from(datetime_utc: DatetimeUtc) -> Self { - Self { - chrono_datetime_utc: datetime_utc - .borrow() - .to_string() - .parse::<DateTime<Utc>>().unwrap() - .with_time(NaiveTime::from_hms_opt(0, 0, 0).unwrap()).unwrap(), - } - } -} - -impl<T> From<T> for DateUtc where T: Borrow<DateTime<Utc>> { - fn from(chrono_datetime_utc: T) -> Self { - Self { - chrono_datetime_utc: chrono_datetime_utc - .borrow() - .with_time(NaiveTime::from_hms_opt(0, 0, 0).unwrap()).unwrap(), - } - } -} - -impl fmt::Display for DateUtc { - /// Converts to a day string, YYYY-MM-DD, in UTC - /// Example: 10.30am 24 Oct 2024 UTC -> "2024-10-24" - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - let date_str = self.chrono_datetime_utc.to_rfc3339(); - let day_str = date_str - .split_at_checked(10) - .unwrap() - .0; - write!(f, "{}", day_str) - } -} - -impl FromStr for DateUtc { - type Err = anyhow::Error; - - /// Constructs DatetimeUtc from a day string, YYYY-MM-DD, in UTC - /// Example: "2024-10-24" -> Midnight 24 Oct 2024 UTC - fn from_str(date_str: &str) -> Result<Self> { - if !Self::is_day_str(&date_str) { - Err(Error::msg(format!("{} is not a day string in YYYY-MM-DD format", date_str))) - } else { - let mut datetime_str = String::from(date_str); - datetime_str.push_str("T00:00:00.000Z"); - Ok(Self { - chrono_datetime_utc: datetime_str.parse()?, - }) - } - } -} - -impl ToSql<Text, Sqlite> for DateUtc { - fn to_sql<'b>( - &'b self, - out: &mut diesel::serialize::Output<'b, '_, Sqlite>, - ) -> serialize::Result { - out.set_value(self.to_string()); - Ok(serialize::IsNull::No) - } -} - -impl FromSql<Text, Sqlite> for DateUtc { - fn from_sql(bytes: <Sqlite as Backend>::RawValue<'_>) -> deserialize::Result<DateUtc> { - let str = <String as FromSql<Text, Sqlite>>::from_sql(bytes)?; - Ok(str.parse()?) - } -} - -#[cfg(test)] -mod test { - use crate::traits::timeable::Timeable; - - use super::*; - - #[test] - fn when_from_ymd_then_ymd_are_as_expected() { - let date_utc = DateUtc::from_ymd(1970, 11, 23); - - assert!(date_utc.is_ok()); - let date_utc = date_utc.unwrap(); - assert_eq!(date_utc.year(), 1970); - assert_eq!(date_utc.month(), 11); - assert_eq!(date_utc.day(), 23); - } - - #[test] - fn when_from_ymd_then_to_string_as_expected() { - let date_utc = DateUtc::from_ymd(1970, 11, 23); - - assert!(date_utc.is_ok()); - assert_eq!(date_utc.unwrap().to_string(), "1970-11-23"); - } - - #[test] - fn when_from_invalid_ymd_then_err() { - let date_utc_1 = DateUtc::from_ymd(1970, 0, 23); - let date_utc_2 = DateUtc::from_ymd(1970, 13, 23); - let date_utc_3 = DateUtc::from_ymd(1970, 11, 0); - let date_utc_4 = DateUtc::from_ymd(1970, 11, 31); - let date_utc_5 = DateUtc::from_ymd(1971, 2, 29); - - assert!(date_utc_1.is_err()); - assert_eq!(date_utc_1.unwrap_err().to_string(), "failed to construct date from ymd 1970-00-23"); - assert!(date_utc_2.is_err()); - assert_eq!(date_utc_2.unwrap_err().to_string(), "failed to construct date from ymd 1970-13-23"); - assert!(date_utc_3.is_err()); - assert_eq!(date_utc_3.unwrap_err().to_string(), "failed to construct date from ymd 1970-11-00"); - assert!(date_utc_4.is_err()); - assert_eq!(date_utc_4.unwrap_err().to_string(), "failed to construct date from ymd 1970-11-31"); - assert!(date_utc_5.is_err()); - assert_eq!(date_utc_5.unwrap_err().to_string(), "failed to construct date from ymd 1971-02-29"); - } - - #[test] - fn when_from_string_then_ymd_are_as_expected() { - let date_utc: Result<DateUtc> = "1970-11-23".parse(); - - assert!(date_utc.is_ok()); - let date_utc = date_utc.unwrap(); - assert_eq!(date_utc.year(), 1970); - assert_eq!(date_utc.month(), 11); - assert_eq!(date_utc.day(), 23); - } - - #[test] - fn when_from_string_then_to_string_as_expected() { - let date_utc: Result<DateUtc> = "1970-11-23".parse(); - - assert!(date_utc.is_ok()); - assert_eq!(date_utc.unwrap().to_string(), "1970-11-23"); - } - - #[test] - fn when_from_invalid_string_then_err() { - let date_utc_1: Result<DateUtc> = "1970-00-23".parse(); - let date_utc_2: Result<DateUtc> = "1970-13-23".parse(); - let date_utc_3: Result<DateUtc> = "1970-11-0".parse(); - let date_utc_4: Result<DateUtc> = "1970-11-31".parse(); - let date_utc_5: Result<DateUtc> = "1971-02-29".parse(); - - assert!(date_utc_1.is_err()); - assert!(date_utc_2.is_err()); - assert!(date_utc_3.is_err()); - assert!(date_utc_4.is_err()); - assert!(date_utc_5.is_err()); - } - - #[test] - fn with_with_hms_then_ymd_hms_are_as_expected() { - let datetime_utc = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(12, 55, 16); - - assert!(datetime_utc.is_ok()); - let datetime_utc = datetime_utc.unwrap(); - assert_eq!(datetime_utc.year(), 1970); - assert_eq!(datetime_utc.month(), 11); - assert_eq!(datetime_utc.day(), 23); - assert_eq!(datetime_utc.hour(), 12); - assert_eq!(datetime_utc.minute(), 55); - assert_eq!(datetime_utc.second(), 16); - } - - #[test] - fn when_with_invalid_hms_then_err() { - let datetime_utc_1 = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(25, 0, 0); - let datetime_utc_2 = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(0, 61, 0); - let datetime_utc_3 = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(0, 0, 61); - - assert!(datetime_utc_1.is_err()); - assert!(datetime_utc_2.is_err()); - assert!(datetime_utc_3.is_err()); - } - - #[test] - fn when_from_datetime_utc_at_different_times_on_same_day_then_eq() { - let datetime_utc1 = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(0, 0, 0).unwrap(); - let datetime_utc2 = DateUtc::from_ymd(1970, 11, 23).unwrap().with_hms(23, 59, 59).unwrap(); - let date_utc1 = DateUtc::from(datetime_utc1); - let date_utc2 = DateUtc::from(datetime_utc2); - - assert_eq!(date_utc1, date_utc2); - } - - #[test] - fn given_today_when_day_diff_today_then_return_0() { - let start = DateUtc::from_ymd(2000, 1, 1).unwrap(); - let end = DateUtc::from_ymd(2000, 1, 1).unwrap(); - - let day_diff = start.day_diff(&end); - let neg_day_diff = end.day_diff(&start); - - assert_eq!(day_diff, 0); - assert_eq!(day_diff, neg_day_diff); - } - - #[test] - fn given_today_when_day_diff_tomorrow_then_return_1() { - let start = DateUtc::from_ymd(2000, 1, 1).unwrap(); - let end = DateUtc::from_ymd(2000, 1, 2).unwrap(); - - let day_diff = start.day_diff(&end); - let neg_day_diff = end.day_diff(&start); - - assert_eq!(day_diff, 1); - assert_eq!(day_diff, neg_day_diff); - } -} diff --git a/backend/core/src/models/datetime_utc.rs b/backend/core/src/models/datetime_utc.rs deleted file mode 100644 index 98d1d6c..0000000 --- a/backend/core/src/models/datetime_utc.rs +++ /dev/null @@ -1,223 +0,0 @@ -use std::{fmt::Display, str::FromStr}; - -use anyhow::{Context, Result}; -use chrono::{DateTime, Datelike as ChronoDatelike, NaiveDate, Timelike as ChronoTimelike, Utc}; -use diesel::{ - backend::Backend, - deserialize::{self, FromSql, FromSqlRow}, - expression::AsExpression, - serialize::{self, ToSql}, - sql_types::Text, - sqlite::Sqlite, -}; -use serde::{Deserialize, Serialize}; - -use crate::traits::{dateable::Dateable, nowlike::Nowlike, timeable::Timeable}; - -#[derive( - PartialEq, - Eq, - PartialOrd, - Ord, - Serialize, - Deserialize, - Clone, - Debug, - AsExpression, - FromSqlRow, -)] -#[diesel(sql_type=Text)] -pub struct DatetimeUtc { - chrono_datetime_utc: DateTime<Utc>, -} - -impl DatetimeUtc { - pub fn from_ymd_and_hms(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -> Result<Self> { - Ok(Self { chrono_datetime_utc: NaiveDate - ::from_ymd_opt(year, month, day) - .with_context(|| format!("failed to construct datetime from ymd {:04}-{:02}-{:02}", year, month, day))? - .and_hms_opt(hour, min, sec) - .with_context(|| format!("failed to construct datetime from hms {:02}:{:02}:{:02}", hour, min, sec))? - .and_utc() - }) - } -} - -impl FromStr for DatetimeUtc { - type Err = anyhow::Error; - - /// Constructs DatetimeUtc from a date string in ISO format, in UTC - /// Example: "2024-10-24T10:30:00.000" -> 10.30am 24 Oct 2024 UTC - fn from_str(datetime_str: &str) -> Result<Self> { - let chrono_datetime_utc = datetime_str.parse::<DateTime<Utc>>()?; - Ok(Self { - chrono_datetime_utc, - }) - } -} - -impl Display for DatetimeUtc { - /// Converts to a date string in ISO format, in UTC - /// Example: 10.30am 24 Oct 2024 UTC -> "2024-10-24T10:30:00.000Z" - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "{}", self.chrono_datetime_utc.to_rfc3339_opts(chrono::SecondsFormat::Millis, true)) - } -} - -impl Nowlike for DatetimeUtc { - fn now() -> Self { - let now = Utc::now(); - Self::from_ymd_and_hms( - now.year(), - now.month(), - now.day(), - now.hour(), - now.minute(), - now.second(), - ).unwrap() - } -} - -impl Dateable for DatetimeUtc { - fn year(&self) -> i32 { - self.chrono_datetime_utc.year() - } - - fn month(&self) -> u32 { - self.chrono_datetime_utc.month() - } - - fn day(&self) -> u32 { - self.chrono_datetime_utc.day() - } -} - -impl Timeable for DatetimeUtc { - fn hour(&self) -> u32 { - self.chrono_datetime_utc.hour() - } - - fn minute(&self) -> u32 { - self.chrono_datetime_utc.minute() - } - - fn second(&self) -> u32 { - self.chrono_datetime_utc.second() - } -} - -impl ToSql<Text, Sqlite> for DatetimeUtc { - fn to_sql<'b>( - &'b self, - out: &mut diesel::serialize::Output<'b, '_, Sqlite>, - ) -> serialize::Result { - out.set_value::<String>(self.to_string()); - Ok(serialize::IsNull::No) - } -} - -impl FromSql<Text, Sqlite> for DatetimeUtc { - fn from_sql(bytes: <Sqlite as Backend>::RawValue<'_>) -> deserialize::Result<DatetimeUtc> { - let str = <String as FromSql<Text, Sqlite>>::from_sql(bytes)?; - Ok(str.parse()?) - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn when_from_ymd_and_hms_then_ymd_and_hms_are_as_expected() { - let datetime_utc = DatetimeUtc::from_ymd_and_hms(1970, 11, 23, 12, 55, 16); - - assert!(datetime_utc.is_ok()); - let date_utc = datetime_utc.unwrap(); - assert_eq!(date_utc.year(), 1970); - assert_eq!(date_utc.month(), 11); - assert_eq!(date_utc.day(), 23); - assert_eq!(date_utc.hour(), 12); - assert_eq!(date_utc.minute(), 55); - assert_eq!(date_utc.second(), 16); - } - - #[test] - fn when_from_ymd_and_hms_then_to_string_as_expected() { - let date_utc = DatetimeUtc::from_ymd_and_hms(1970, 11, 23, 12, 55, 16); - - assert!(date_utc.is_ok()); - assert_eq!(date_utc.unwrap().to_string(), "1970-11-23T12:55:16.000Z") - } - - #[test] - fn when_with_invalid_ymd_and_hms_then_err() { - let datetime_utc_1 = DatetimeUtc::from_ymd_and_hms(1970, 0, 23, 12, 55, 16); - let datetime_utc_2 = DatetimeUtc::from_ymd_and_hms(1970, 13, 23, 12, 55, 16); - let datetime_utc_3 = DatetimeUtc::from_ymd_and_hms(1970, 11, 0, 12, 55, 16); - let datetime_utc_4 = DatetimeUtc::from_ymd_and_hms(1970, 11, 31, 12, 55, 16); - let datetime_utc_5 = DatetimeUtc::from_ymd_and_hms(1971, 2, 29, 12, 55, 16); - let datetime_utc_6 = DatetimeUtc::from_ymd_and_hms(1970, 11, 23, 25, 0, 0); - let datetime_utc_7 = DatetimeUtc::from_ymd_and_hms(1970, 11, 23, 0, 61, 0); - let datetime_utc_8 = DatetimeUtc::from_ymd_and_hms(1970, 11, 23, 0, 0, 61); - - assert!(datetime_utc_1.is_err()); - assert_eq!(datetime_utc_1.unwrap_err().to_string(), "failed to construct datetime from ymd 1970-00-23"); - assert!(datetime_utc_2.is_err()); - assert_eq!(datetime_utc_2.unwrap_err().to_string(), "failed to construct datetime from ymd 1970-13-23"); - assert!(datetime_utc_3.is_err()); - assert_eq!(datetime_utc_3.unwrap_err().to_string(), "failed to construct datetime from ymd 1970-11-00"); - assert!(datetime_utc_4.is_err()); - assert_eq!(datetime_utc_4.unwrap_err().to_string(), "failed to construct datetime from ymd 1970-11-31"); - assert!(datetime_utc_5.is_err()); - assert_eq!(datetime_utc_5.unwrap_err().to_string(), "failed to construct datetime from ymd 1971-02-29"); - assert!(datetime_utc_6.is_err()); - assert_eq!(datetime_utc_6.unwrap_err().to_string(), "failed to construct datetime from hms 25:00:00"); - assert!(datetime_utc_7.is_err()); - assert_eq!(datetime_utc_7.unwrap_err().to_string(), "failed to construct datetime from hms 00:61:00"); - assert!(datetime_utc_8.is_err()); - assert_eq!(datetime_utc_8.unwrap_err().to_string(), "failed to construct datetime from hms 00:00:61"); - } - - #[test] - fn when_from_string_then_ymd_and_hms_are_as_expected() { - let date_utc: Result<DatetimeUtc> = "1970-11-23T12:55:16.000Z".parse(); - - assert!(date_utc.is_ok()); - let datetime_utc = date_utc.unwrap(); - assert_eq!(datetime_utc.year(), 1970); - assert_eq!(datetime_utc.month(), 11); - assert_eq!(datetime_utc.day(), 23); - assert_eq!(datetime_utc.hour(), 12); - assert_eq!(datetime_utc.minute(), 55); - assert_eq!(datetime_utc.second(), 16); - } - - #[test] - fn when_from_string_then_to_string_as_expected() { - let datetime_utc: Result<DatetimeUtc> = "1970-11-23T12:55:16.000Z".parse(); - - assert!(datetime_utc.is_ok()); - assert_eq!(datetime_utc.unwrap().to_string(), "1970-11-23T12:55:16.000Z") - } - - #[test] - fn when_from_invalid_string_then_err() { - let datetime_utc_1: Result<DatetimeUtc> = "1970-00-23T00:00:00.000Z".parse(); - let datetime_utc_2: Result<DatetimeUtc> = "1970-13-23T00:00:00.000Z".parse(); - let datetime_utc_3: Result<DatetimeUtc> = "1970-11-0T00:00:00.000Z".parse(); - let datetime_utc_4: Result<DatetimeUtc> = "1970-11-31T00:00:00.000Z".parse(); - let datetime_utc_5: Result<DatetimeUtc> = "1971-02-29T00:00:00.000Z".parse(); - let datetime_utc_6: Result<DatetimeUtc> = "1970-11-23T25:00:00.000Z".parse(); - let datetime_utc_7: Result<DatetimeUtc> = "1970-11-23T00:61:00.000Z".parse(); - let datetime_utc_8: Result<DatetimeUtc> = "1970-11-23T00:00:61.000Z".parse(); - - assert!(datetime_utc_1.is_err()); - assert!(datetime_utc_2.is_err()); - assert!(datetime_utc_3.is_err()); - assert!(datetime_utc_4.is_err()); - assert!(datetime_utc_5.is_err()); - assert!(datetime_utc_6.is_err()); - assert!(datetime_utc_7.is_err()); - assert!(datetime_utc_8.is_err()); - } -} diff --git a/backend/core/src/models/mod.rs b/backend/core/src/models/mod.rs deleted file mode 100644 index 2eb7ac2..0000000 --- a/backend/core/src/models/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod account; -pub mod budget; -pub mod budget_update; -pub mod category; -pub mod category_balance; -pub mod category_budget; -pub mod category_transfer; -pub mod date_utc; -pub mod datetime_utc; -pub mod transaction; -pub mod transaction_categorisation; diff --git a/backend/core/src/models/transaction.rs b/backend/core/src/models/transaction.rs deleted file mode 100644 index 18a4c0e..0000000 --- a/backend/core/src/models/transaction.rs +++ /dev/null @@ -1,18 +0,0 @@ -use derive_builder::Builder; -use diesel::prelude::*; - -use crate::models::account::Account; - -use super::datetime_utc::DatetimeUtc; - -#[derive(Builder, Queryable, Identifiable, Selectable, Insertable, Associations, Debug, PartialEq)] -#[diesel(table_name = crate::schema::transactions)] -#[diesel(belongs_to(Account))] -pub struct Transaction { - pub id: i32, - pub description: String, - pub payee: String, - pub quantity: i32, - pub date: DatetimeUtc, - pub account_id: i32, -} diff --git a/backend/core/src/models/transaction_categorisation.rs b/backend/core/src/models/transaction_categorisation.rs deleted file mode 100644 index c6ac6ea..0000000 --- a/backend/core/src/models/transaction_categorisation.rs +++ /dev/null @@ -1,12 +0,0 @@ -use derive_builder::Builder; -use diesel::prelude::*; - -#[derive(Builder, Queryable, Identifiable, Selectable, Insertable, Debug, PartialEq)] -#[diesel(table_name = crate::schema::transaction_categorisations)] -pub struct TransactionCategorisation { - pub id: i32, - pub description: String, - pub quantity: i32, - pub transaction_id: i32, - pub category_id: i32, -} diff --git a/backend/core/src/queries/accounts/delete_all.rs b/backend/core/src/queries/accounts/delete_all.rs deleted file mode 100644 index 84d7bf6..0000000 --- a/backend/core/src/queries/accounts/delete_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use diesel::{RunQueryDsl, SqliteConnection}; - -use crate::schema::accounts::dsl::accounts; - -pub fn delete_all_accounts(connection: &mut SqliteConnection) -> Result<usize> { - let num_rows_deleted = diesel::delete(accounts) - .execute(connection) - .with_context(|| "failed to delete all accounts")?; - Ok(num_rows_deleted) -} diff --git a/backend/core/src/queries/accounts/get_all.rs b/backend/core/src/queries/accounts/get_all.rs deleted file mode 100644 index ab53729..0000000 --- a/backend/core/src/queries/accounts/get_all.rs +++ /dev/null @@ -1,10 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::account::Account, schema::accounts::dsl::accounts}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_accounts(connection: &mut SqliteConnection) -> Result<Vec<Account>> { - let all_accounts = accounts.select(Account::as_select()) - .load(connection) - .with_context(|| "failed to get all accounts")?; - Ok(all_accounts) -} diff --git a/backend/core/src/queries/accounts/insert.rs b/backend/core/src/queries/accounts/insert.rs deleted file mode 100644 index 7020b68..0000000 --- a/backend/core/src/queries/accounts/insert.rs +++ /dev/null @@ -1,28 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::account::Account, - schema::accounts::dsl::accounts as accounts_table, -}; -use diesel::prelude::*; - -pub fn insert_accounts( - accounts: &[Account], - connection: &mut SqliteConnection, -) -> Result<usize> { - let num_accounts_inserted = diesel::insert_into(accounts_table) - .values(accounts) - .execute(connection) - .with_context(|| err_msg(accounts))?; - Ok(num_accounts_inserted) -} - -fn err_msg(accounts: &[Account]) -> String { - format!( - "failed to insert accounts: [{}]", - accounts - .iter() - .map(|a| format!("\"{}\": \"{}\"", a.id, a.name)) - .collect::<Vec<String>>() - .join(", ") - ) -} diff --git a/backend/core/src/queries/accounts/mod.rs b/backend/core/src/queries/accounts/mod.rs deleted file mode 100644 index 222b180..0000000 --- a/backend/core/src/queries/accounts/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod delete_all; -mod get_all; -mod insert; - -pub use delete_all::delete_all_accounts; -pub use get_all::get_all_accounts; -pub use insert::insert_accounts; diff --git a/backend/core/src/queries/budget_updates/delete_all.rs b/backend/core/src/queries/budget_updates/delete_all.rs deleted file mode 100644 index b7ad082..0000000 --- a/backend/core/src/queries/budget_updates/delete_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use diesel::{RunQueryDsl, SqliteConnection}; - -use crate::schema::budget_updates::dsl::budget_updates; - -pub fn delete_all_budget_updates(connection: &mut SqliteConnection) -> Result<usize> { - let num_rows_deleted = diesel::delete(budget_updates) - .execute(connection) - .with_context(|| "failed to delete all budget updates")?; - Ok(num_rows_deleted) -} diff --git a/backend/core/src/queries/budget_updates/get_all.rs b/backend/core/src/queries/budget_updates/get_all.rs deleted file mode 100644 index 9c9310b..0000000 --- a/backend/core/src/queries/budget_updates/get_all.rs +++ /dev/null @@ -1,16 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::budget_update::BudgetUpdate, - schema::budget_updates::dsl::budget_updates as budget_updates_table, -}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_budget_updates( - connection: &mut SqliteConnection, -) -> Result<Vec<BudgetUpdate>> { - let all_budget_updates = budget_updates_table - .select(BudgetUpdate::as_select()) - .load::<BudgetUpdate>(connection) - .with_context(|| "failed to get all budget updates")?; - Ok(all_budget_updates) -} diff --git a/backend/core/src/queries/budget_updates/get_first_with_date_and_category_id.rs b/backend/core/src/queries/budget_updates/get_first_with_date_and_category_id.rs deleted file mode 100644 index 2d8f97c..0000000 --- a/backend/core/src/queries/budget_updates/get_first_with_date_and_category_id.rs +++ /dev/null @@ -1,25 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::{budget_update::BudgetUpdate, date_utc::DateUtc}, - schema::budget_updates::{ - self as budget_updates_schema, dsl::budget_updates as budget_updates_table, - }, -}; -use diesel::{ - ExpressionMethods, OptionalExtension, QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection -}; - -pub fn get_first_budget_update_with_date_and_category_id( - date: &DateUtc, - category_id: i32, - connection: &mut SqliteConnection, -) -> Result<Option<BudgetUpdate>> { - let first_budget_update = budget_updates_table - .select(BudgetUpdate::as_select()) - .filter(budget_updates_schema::date.eq(date.to_string())) - .filter(budget_updates_schema::category_id.eq(category_id)) - .first(connection) - .optional() - .with_context(|| format!("failed to get first budget update with date {}", date.to_string()))?; - Ok(first_budget_update) -} diff --git a/backend/core/src/queries/budget_updates/get_most_recent_with_category_id.rs b/backend/core/src/queries/budget_updates/get_most_recent_with_category_id.rs deleted file mode 100644 index 41ef5ec..0000000 --- a/backend/core/src/queries/budget_updates/get_most_recent_with_category_id.rs +++ /dev/null @@ -1,21 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::date_utc::DateUtc, - schema::budget_updates::{ - self as budget_updates_schema, dsl::budget_updates as budget_updates_table, - }, traits::nowlike::Nowlike, -}; -use diesel::{dsl::max, ExpressionMethods, QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn get_most_recent_budget_update_date_with_category_id( - category_id: i32, - connection: &mut SqliteConnection, -) -> Result<Option<DateUtc>> { - let most_recent_date = budget_updates_table - .select(max(budget_updates_schema::date)) - .filter(budget_updates_schema::category_id.eq(category_id)) - .filter(budget_updates_schema::date.le(DateUtc::now())) - .first(connection) - .with_context(|| format!("failed to get most recent budget update date with category ID {}", category_id))?; - Ok(most_recent_date) -} diff --git a/backend/core/src/queries/budget_updates/insert.rs b/backend/core/src/queries/budget_updates/insert.rs deleted file mode 100644 index e8ae271..0000000 --- a/backend/core/src/queries/budget_updates/insert.rs +++ /dev/null @@ -1,28 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::budget_update::BudgetUpdate, - schema::budget_updates::dsl::budget_updates as budget_updates_table, -}; -use diesel::prelude::*; - -pub fn insert_budget_updates( - budget_updates: &[BudgetUpdate], - connection: &mut SqliteConnection, -) -> Result<usize> { - let num_rows_inserted = diesel::insert_into(budget_updates_table) - .values(budget_updates) - .execute(connection) - .with_context(|| err_msg(budget_updates))?; - Ok(num_rows_inserted) -} - -fn err_msg(budget_updates: &[BudgetUpdate]) -> String { - format!( - "failed to insert budget updates: [{}]", - budget_updates - .iter() - .map(|a| a.id.to_string()) - .collect::<Vec<String>>() - .join(", ") - ) -} diff --git a/backend/core/src/queries/budget_updates/mod.rs b/backend/core/src/queries/budget_updates/mod.rs deleted file mode 100644 index 6fc7de0..0000000 --- a/backend/core/src/queries/budget_updates/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod delete_all; -mod get_all; -mod get_first_with_date_and_category_id; -mod get_most_recent_with_category_id; -mod insert; - -pub use delete_all::delete_all_budget_updates; -pub use get_all::get_all_budget_updates; -pub use get_first_with_date_and_category_id::get_first_budget_update_with_date_and_category_id; -pub use get_most_recent_with_category_id::get_most_recent_budget_update_date_with_category_id; -pub use insert::insert_budget_updates; diff --git a/backend/core/src/queries/categories/delete_all.rs b/backend/core/src/queries/categories/delete_all.rs deleted file mode 100644 index 1fd2581..0000000 --- a/backend/core/src/queries/categories/delete_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use diesel::{RunQueryDsl, SqliteConnection}; - -use crate::schema::categories::dsl::categories; - -pub fn delete_all_categories(connection: &mut SqliteConnection) -> Result<usize> { - let num_rows_deleted = diesel::delete(categories) - .execute(connection) - .with_context(|| "failed to delete all categories")?; - Ok(num_rows_deleted) -} diff --git a/backend/core/src/queries/categories/get_all.rs b/backend/core/src/queries/categories/get_all.rs deleted file mode 100644 index 431ed9c..0000000 --- a/backend/core/src/queries/categories/get_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::category::Category, schema::categories::dsl::categories as categories_table}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_categories(connection: &mut SqliteConnection) -> Result<Vec<Category>> { - let all_categories = categories_table - .select(Category::as_select()) - .load(connection) - .with_context(|| "failed to get all categories")?; - Ok(all_categories) -} diff --git a/backend/core/src/queries/categories/get_all_balances.rs b/backend/core/src/queries/categories/get_all_balances.rs deleted file mode 100644 index c9a0102..0000000 --- a/backend/core/src/queries/categories/get_all_balances.rs +++ /dev/null @@ -1,47 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::category_balance::CategoryBalance, queries::{ - budget_updates::get_all_budget_updates, - categories::get_all_categories, - category_transfers::{ - sum_category_transfer_quantity_per_from_category_id, - sum_category_transfer_quantity_per_to_category_id, - }, - transaction_categorisations::sum_transaction_categorisation_quantity_per_category_id, - }, utils::calculate_category_balance}; -use diesel::SqliteConnection; - -pub fn get_all_category_balances( - connection: &mut SqliteConnection, -) -> Result<Vec<CategoryBalance>> { - get_all_category_balances_without_context(connection) - .with_context(|| "failed to get all category balances") -} - -fn get_all_category_balances_without_context( - connection: &mut SqliteConnection, -) -> Result<Vec<CategoryBalance>> { - let categories = get_all_categories(connection)?; - let transaction_sums = sum_transaction_categorisation_quantity_per_category_id(connection)?; - let category_transfer_from_sums = - sum_category_transfer_quantity_per_from_category_id(connection)?; - let category_transfer_to_sums = sum_category_transfer_quantity_per_to_category_id(connection)?; - let budget_updates = get_all_budget_updates(connection)?; - - let mut balances = Vec::<CategoryBalance>::new(); - for category in categories { - let balance = calculate_category_balance( - &category, - &transaction_sums, - &category_transfer_from_sums, - &category_transfer_to_sums, - &budget_updates, - )?; - - balances.push(CategoryBalance { - category_id: category.id, - balance: balance.try_into().unwrap(), - }) - } - - Ok(balances) -} diff --git a/backend/core/src/queries/categories/get_all_ids.rs b/backend/core/src/queries/categories/get_all_ids.rs deleted file mode 100644 index 8505e71..0000000 --- a/backend/core/src/queries/categories/get_all_ids.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use crate::schema::categories::{self as categories_schema, dsl::categories as categories_table}; -use diesel::{QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn get_all_category_ids(connection: &mut SqliteConnection) -> Result<Vec<i32>> { - let all_category_ids = categories_table - .select(categories_schema::id) - .load(connection) - .with_context(|| "failed to get all category IDs")?; - Ok(all_category_ids) -} diff --git a/backend/core/src/queries/categories/get_most_recent_budget_per_category_id.rs b/backend/core/src/queries/categories/get_most_recent_budget_per_category_id.rs deleted file mode 100644 index 9f2e4f6..0000000 --- a/backend/core/src/queries/categories/get_most_recent_budget_per_category_id.rs +++ /dev/null @@ -1,52 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::{budget::Budget, category_budget::CategoryBudget}, queries::{ - budget_updates::{ - get_first_budget_update_with_date_and_category_id, get_most_recent_budget_update_date_with_category_id, - }, - categories::get_all_category_ids, -}}; -use diesel::SqliteConnection; - -pub fn get_most_recent_category_budget_per_category_id( - connection: &mut SqliteConnection, -) -> Result<Vec<CategoryBudget>> { - get_most_recent_category_budget_per_category_id_without_context(connection) - .with_context(|| "failed to get most recent category budget per category ID") -} - -fn get_most_recent_category_budget_per_category_id_without_context( - connection: &mut SqliteConnection, -) -> Result<Vec<CategoryBudget>> { - let category_ids: Vec<i32> = get_all_category_ids(connection)?; - - let mut budgets = Vec::<CategoryBudget>::new(); - for category_id in category_ids { - let most_recent_budget_update_date = - get_most_recent_budget_update_date_with_category_id(category_id, connection)?; - - if most_recent_budget_update_date.is_none() { - budgets.push(CategoryBudget { - category_id, - budget: Option::None, - }); - continue; - } - let most_recent_budget_update_date = most_recent_budget_update_date.unwrap(); - - let most_recent_budget_update = get_first_budget_update_with_date_and_category_id( - &most_recent_budget_update_date, - category_id, - connection, - )?; - // The fact we found the date by getting the most recent budget update - // date guarantees that the Option is Some - let most_recent_budget_update = most_recent_budget_update.unwrap(); - - budgets.push(CategoryBudget { - category_id, - budget: Some(Budget::from(&most_recent_budget_update)), - }); - } - - Ok(budgets) -} diff --git a/backend/core/src/queries/categories/insert.rs b/backend/core/src/queries/categories/insert.rs deleted file mode 100644 index bccba72..0000000 --- a/backend/core/src/queries/categories/insert.rs +++ /dev/null @@ -1,28 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{ - models::category::Category, - schema::categories::dsl::categories as categories_table, -}; -use diesel::prelude::*; - -pub fn insert_categories( - categories: &[Category], - connection: &mut SqliteConnection, -) -> Result<usize> { - let num_categories_inserted = diesel::insert_into(categories_table) - .values(categories) - .execute(connection) - .with_context(|| err_msg(categories))?; - Ok(num_categories_inserted) -} - -fn err_msg(categories: &[Category]) -> String { - format!( - "failed to insert categories: [{}]", - categories - .iter() - .map(|a| format!("\"{}\": \"{}\"", a.id, a.name)) - .collect::<Vec<String>>() - .join(", ") - ) -} diff --git a/backend/core/src/queries/categories/mod.rs b/backend/core/src/queries/categories/mod.rs deleted file mode 100644 index edeeebf..0000000 --- a/backend/core/src/queries/categories/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod delete_all; -mod get_all; -mod get_all_balances; -mod get_all_ids; -mod get_most_recent_budget_per_category_id; -mod insert; - -pub use delete_all::delete_all_categories; -pub use get_all::get_all_categories; -pub use get_all_balances::get_all_category_balances; -pub use get_all_ids::get_all_category_ids; -pub use get_most_recent_budget_per_category_id::get_most_recent_category_budget_per_category_id; -pub use insert::insert_categories; diff --git a/backend/core/src/queries/category_transfers/delete_all.rs b/backend/core/src/queries/category_transfers/delete_all.rs deleted file mode 100644 index 406b80b..0000000 --- a/backend/core/src/queries/category_transfers/delete_all.rs +++ /dev/null @@ -1,7 +0,0 @@ -use diesel::{result::Error, RunQueryDsl, SqliteConnection}; - -use crate::schema::category_transfers::dsl::category_transfers; - -pub fn delete_all_category_transfers(connection: &mut SqliteConnection) -> Result<usize, Error> { - diesel::delete(category_transfers).execute(connection) -} diff --git a/backend/core/src/queries/category_transfers/get_all.rs b/backend/core/src/queries/category_transfers/get_all.rs deleted file mode 100644 index 73d7e10..0000000 --- a/backend/core/src/queries/category_transfers/get_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::category_transfer::CategoryTransfer, schema::category_transfers::dsl::category_transfers as category_transfers_table}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_category_transfers(connection: &mut SqliteConnection) -> Result<Vec<CategoryTransfer>> { - let all_category_transfers = category_transfers_table - .select(CategoryTransfer::as_select()) - .load(connection) - .with_context(|| "failed to get all category transfers")?; - Ok(all_category_transfers) -} diff --git a/backend/core/src/queries/category_transfers/insert.rs b/backend/core/src/queries/category_transfers/insert.rs deleted file mode 100644 index e1db167..0000000 --- a/backend/core/src/queries/category_transfers/insert.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::{ - models::category_transfer::CategoryTransfer, - schema::category_transfers::dsl::category_transfers as category_transfers_table, -}; -use diesel::prelude::*; -use diesel::result::Error; - -pub fn insert_category_transfers( - category_transfers: &[CategoryTransfer], - connection: &mut SqliteConnection, -) -> Result<usize, Error> { - diesel::insert_into(category_transfers_table) - .values(category_transfers) - .execute(connection) -} diff --git a/backend/core/src/queries/category_transfers/mod.rs b/backend/core/src/queries/category_transfers/mod.rs deleted file mode 100644 index eed7946..0000000 --- a/backend/core/src/queries/category_transfers/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod delete_all; -mod get_all; -mod insert; -mod sum_quantity_per_from_category_id; -mod sum_quantity_per_to_category_id; - -pub use delete_all::delete_all_category_transfers; -pub use get_all::get_all_category_transfers; -pub use insert::insert_category_transfers; -pub use sum_quantity_per_from_category_id::sum_category_transfer_quantity_per_from_category_id; -pub use sum_quantity_per_to_category_id::sum_category_transfer_quantity_per_to_category_id; diff --git a/backend/core/src/queries/category_transfers/sum_quantity_per_from_category_id.rs b/backend/core/src/queries/category_transfers/sum_quantity_per_from_category_id.rs deleted file mode 100644 index a9c2a8c..0000000 --- a/backend/core/src/queries/category_transfers/sum_quantity_per_from_category_id.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::schema::category_transfers::{ - self as category_transfers_schema, - dsl::category_transfers as category_transfers_table, -}; -use diesel::{dsl::sum, result::Error, QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn sum_category_transfer_quantity_per_from_category_id( - connection: &mut SqliteConnection, -) -> Result<Vec<(i32, i64)>, Error> { - category_transfers_table - .group_by(category_transfers_schema::from_category_id) - .select(( - category_transfers_schema::from_category_id, - sum(category_transfers_schema::quantity), - )) - .load::<(i32, Option<i64>)>(connection) - .map(|result| result.iter().map(|sum| (sum.0, sum.1.unwrap_or(0))).collect()) -} diff --git a/backend/core/src/queries/category_transfers/sum_quantity_per_to_category_id.rs b/backend/core/src/queries/category_transfers/sum_quantity_per_to_category_id.rs deleted file mode 100644 index f041477..0000000 --- a/backend/core/src/queries/category_transfers/sum_quantity_per_to_category_id.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::schema::category_transfers::{ - self as category_transfers_schema, - dsl::category_transfers as category_transfers_table, -}; -use diesel::{dsl::sum, result::Error, QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn sum_category_transfer_quantity_per_to_category_id( - connection: &mut SqliteConnection, -) -> Result<Vec<(i32, i64)>, Error> { - category_transfers_table - .group_by(category_transfers_schema::to_category_id) - .select(( - category_transfers_schema::to_category_id, - sum(category_transfers_schema::quantity), - )) - .load::<(i32, Option<i64>)>(connection) - .map(|vec| vec.iter().map(|(id, sum)| (*id, sum.unwrap_or(0))).collect()) -} diff --git a/backend/core/src/queries/clear.rs b/backend/core/src/queries/clear.rs deleted file mode 100644 index e704634..0000000 --- a/backend/core/src/queries/clear.rs +++ /dev/null @@ -1,20 +0,0 @@ -use anyhow::Result; -use crate::queries::{ - accounts::delete_all_accounts, - budget_updates::delete_all_budget_updates, - categories::delete_all_categories, - category_transfers::delete_all_category_transfers, - transactions::delete_all_transactions, - transaction_categorisations::delete_all_transaction_categorisations, -}; -use diesel::SqliteConnection; - -pub fn clear(connection: &mut SqliteConnection) -> Result<()> { - delete_all_accounts(connection)?; - delete_all_budget_updates(connection)?; - delete_all_categories(connection)?; - delete_all_category_transfers(connection)?; - delete_all_transactions(connection)?; - delete_all_transaction_categorisations(connection)?; - Ok(()) -} diff --git a/backend/core/src/queries/mod.rs b/backend/core/src/queries/mod.rs deleted file mode 100644 index f0852ce..0000000 --- a/backend/core/src/queries/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod accounts; -pub mod budget_updates; -pub mod categories; -pub mod category_transfers; -pub mod clear; -pub mod transactions; -pub mod transaction_categorisations; diff --git a/backend/core/src/queries/transaction_categorisations/delete_all.rs b/backend/core/src/queries/transaction_categorisations/delete_all.rs deleted file mode 100644 index e80a0ca..0000000 --- a/backend/core/src/queries/transaction_categorisations/delete_all.rs +++ /dev/null @@ -1,7 +0,0 @@ -use diesel::{result::Error, RunQueryDsl, SqliteConnection}; - -use crate::schema::transaction_categorisations::dsl::transaction_categorisations; - -pub fn delete_all_transaction_categorisations(connection: &mut SqliteConnection) -> Result<usize, Error> { - diesel::delete(transaction_categorisations).execute(connection) -} diff --git a/backend/core/src/queries/transaction_categorisations/get_all.rs b/backend/core/src/queries/transaction_categorisations/get_all.rs deleted file mode 100644 index 0cacfe6..0000000 --- a/backend/core/src/queries/transaction_categorisations/get_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::transaction_categorisation::TransactionCategorisation, schema::transaction_categorisations::dsl::transaction_categorisations as transaction_categorisations_table}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_transaction_categorisations(connection: &mut SqliteConnection) -> Result<Vec<TransactionCategorisation>> { - let all_transaction_categorisations = transaction_categorisations_table - .select(TransactionCategorisation::as_select()) - .load(connection) - .with_context(|| "failed to get all transaction categorisations")?; - Ok(all_transaction_categorisations) -} diff --git a/backend/core/src/queries/transaction_categorisations/insert.rs b/backend/core/src/queries/transaction_categorisations/insert.rs deleted file mode 100644 index 3da1c33..0000000 --- a/backend/core/src/queries/transaction_categorisations/insert.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::{ - models::transaction_categorisation::TransactionCategorisation, - schema::transaction_categorisations::dsl::transaction_categorisations as transaction_categorisations_table, -}; -use diesel::prelude::*; -use diesel::result::Error; - -pub fn insert_transaction_categorisations( - transaction_categorisations: &[TransactionCategorisation], - connection: &mut SqliteConnection, -) -> Result<usize, Error> { - diesel::insert_into(transaction_categorisations_table) - .values(transaction_categorisations) - .execute(connection) -} diff --git a/backend/core/src/queries/transaction_categorisations/mod.rs b/backend/core/src/queries/transaction_categorisations/mod.rs deleted file mode 100644 index d383791..0000000 --- a/backend/core/src/queries/transaction_categorisations/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod delete_all; -mod get_all; -mod insert; -mod sum_quantity_per_category_id; - -pub use delete_all::delete_all_transaction_categorisations; -pub use get_all::get_all_transaction_categorisations; -pub use insert::insert_transaction_categorisations; -pub use sum_quantity_per_category_id::sum_transaction_categorisation_quantity_per_category_id; diff --git a/backend/core/src/queries/transaction_categorisations/sum_quantity_per_category_id.rs b/backend/core/src/queries/transaction_categorisations/sum_quantity_per_category_id.rs deleted file mode 100644 index 61f3492..0000000 --- a/backend/core/src/queries/transaction_categorisations/sum_quantity_per_category_id.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::schema::transaction_categorisations::{ - self as transaction_categorisations_schema, - dsl::transaction_categorisations as transaction_categorisations_table, -}; -use diesel::{dsl::sum, result::Error, QueryDsl, RunQueryDsl, SqliteConnection}; - -pub fn sum_transaction_categorisation_quantity_per_category_id( - connection: &mut SqliteConnection, -) -> Result<Vec<(i32, i64)>, Error> { - transaction_categorisations_table - .group_by(transaction_categorisations_schema::category_id) - .select(( - transaction_categorisations_schema::category_id, - sum(transaction_categorisations_schema::quantity), - )) - .load::<(i32, Option<i64>)>(connection) - .map(|vec| vec.iter().map(|(category_id, sum)| (*category_id, sum.unwrap_or(0))).collect()) -} diff --git a/backend/core/src/queries/transactions/delete_all.rs b/backend/core/src/queries/transactions/delete_all.rs deleted file mode 100644 index 43b7976..0000000 --- a/backend/core/src/queries/transactions/delete_all.rs +++ /dev/null @@ -1,7 +0,0 @@ -use diesel::{result::Error, RunQueryDsl, SqliteConnection}; - -use crate::schema::transactions::dsl::transactions; - -pub fn delete_all_transactions(connection: &mut SqliteConnection) -> Result<usize, Error> { - diesel::delete(transactions).execute(connection) -} diff --git a/backend/core/src/queries/transactions/get_all.rs b/backend/core/src/queries/transactions/get_all.rs deleted file mode 100644 index afb87f4..0000000 --- a/backend/core/src/queries/transactions/get_all.rs +++ /dev/null @@ -1,11 +0,0 @@ -use anyhow::{Context, Result}; -use crate::{models::transaction::Transaction, schema::transactions::dsl::transactions as transactions_table}; -use diesel::{QueryDsl, RunQueryDsl, SelectableHelper, SqliteConnection}; - -pub fn get_all_transactions(connection: &mut SqliteConnection) -> Result<Vec<Transaction>> { - let all_transactions = transactions_table - .select(Transaction::as_select()) - .load(connection) - .with_context(|| "failed to get all category transfers")?; - Ok(all_transactions) -} diff --git a/backend/core/src/queries/transactions/insert.rs b/backend/core/src/queries/transactions/insert.rs deleted file mode 100644 index 32f3dc2..0000000 --- a/backend/core/src/queries/transactions/insert.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::{ - models::transaction::Transaction, - schema::transactions::dsl::transactions as transactions_table, -}; -use diesel::prelude::*; -use diesel::result::Error; - -pub fn insert_transactions( - transactions: &[Transaction], - connection: &mut SqliteConnection, -) -> Result<usize, Error> { - diesel::insert_into(transactions_table) - .values(transactions) - .execute(connection) -} diff --git a/backend/core/src/queries/transactions/mod.rs b/backend/core/src/queries/transactions/mod.rs deleted file mode 100644 index 983e9af..0000000 --- a/backend/core/src/queries/transactions/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod delete_all; -mod get_all; -mod insert; - -pub use delete_all::delete_all_transactions; -pub use get_all::get_all_transactions; -pub use insert::insert_transactions; diff --git a/backend/core/src/schema.rs b/backend/core/src/schema.rs deleted file mode 100644 index 372f8f3..0000000 --- a/backend/core/src/schema.rs +++ /dev/null @@ -1,72 +0,0 @@ -// @generated automatically by Diesel CLI. - -diesel::table! { - accounts (id) { - id -> Integer, - name -> Text, - opening_balance -> Integer, - opening_date -> Text, - } -} - -diesel::table! { - budget_updates (id) { - id -> Integer, - category_id -> Integer, - date -> Text, - new_budget -> Integer, - new_period -> Integer, - } -} - -diesel::table! { - categories (id) { - id -> Integer, - name -> Text, - } -} - -diesel::table! { - category_transfers (id) { - id -> Integer, - description -> Text, - quantity -> Integer, - from_category_id -> Integer, - to_category_id -> Integer, - } -} - -diesel::table! { - transaction_categorisations (id) { - id -> Integer, - description -> Text, - quantity -> Integer, - transaction_id -> Integer, - category_id -> Integer, - } -} - -diesel::table! { - transactions (id) { - id -> Integer, - description -> Text, - payee -> Text, - quantity -> Integer, - date -> Text, - account_id -> Integer, - } -} - -diesel::joinable!(budget_updates -> categories (category_id)); -diesel::joinable!(transaction_categorisations -> categories (category_id)); -diesel::joinable!(transaction_categorisations -> transactions (transaction_id)); -diesel::joinable!(transactions -> accounts (account_id)); - -diesel::allow_tables_to_appear_in_same_query!( - accounts, - budget_updates, - categories, - category_transfers, - transaction_categorisations, - transactions, -); diff --git a/backend/core/src/traits/dateable.rs b/backend/core/src/traits/dateable.rs deleted file mode 100644 index 05f2d74..0000000 --- a/backend/core/src/traits/dateable.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub trait Dateable { - fn year(&self) -> i32; - fn month(&self) -> u32; - fn day(&self) -> u32; -} diff --git a/backend/core/src/traits/mod.rs b/backend/core/src/traits/mod.rs deleted file mode 100644 index ab5caca..0000000 --- a/backend/core/src/traits/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod dateable; -pub mod nowlike; -pub mod timeable; diff --git a/backend/core/src/traits/nowlike.rs b/backend/core/src/traits/nowlike.rs deleted file mode 100644 index bae2309..0000000 --- a/backend/core/src/traits/nowlike.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub trait Nowlike { - fn now() -> Self; -} diff --git a/backend/core/src/traits/timeable.rs b/backend/core/src/traits/timeable.rs deleted file mode 100644 index f6f9244..0000000 --- a/backend/core/src/traits/timeable.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub trait Timeable { - fn hour(&self) -> u32; - fn minute(&self) -> u32; - fn second(&self) -> u32; -} diff --git a/backend/core/src/utils/calculate_budgets_accrual.rs b/backend/core/src/utils/calculate_budgets_accrual.rs deleted file mode 100644 index 56171ca..0000000 --- a/backend/core/src/utils/calculate_budgets_accrual.rs +++ /dev/null @@ -1,155 +0,0 @@ -use anyhow::Result; -use crate::{models::{ - budget_update::BudgetUpdate, category::Category, date_utc::DateUtc -}, traits::nowlike::Nowlike}; - -pub fn calculate_budgets_accrual(category: &Category, budget_updates: &[BudgetUpdate]) -> Result<i64> { - let mut budget_updates = budget_updates - .iter() - .filter(|bu| bu.category_id == category.id) - .collect::<Vec<&BudgetUpdate>>(); - budget_updates.sort_by_key(|bu| bu.date.clone()); - budget_updates.reverse(); - - let mut budgets_accrual = 0.0_f64; - let mut calculated_back_to_date = DateUtc::now(); - - for budget_update in budget_updates { - let days_on_this_budget = calculated_back_to_date.day_diff(&budget_update.date); - if days_on_this_budget == 0_u32 { - return Err(anyhow::Error::msg(format!( - "failed to calculate budgets accrual since two budget updates had the same date ({})", - budget_update.date, - ))); - } - let budget_per_day = budget_update.new_budget as f64 / budget_update.new_period as f64; - budgets_accrual += days_on_this_budget as f64 * budget_per_day; - calculated_back_to_date = budget_update.date.clone(); - } - - Ok(budgets_accrual.floor() as i64) -} - -#[cfg(test)] -mod test { - use chrono::{Days, Utc}; - - use crate::{ - models::{budget_update::BudgetUpdate, category::Category, date_utc::DateUtc}, traits::nowlike::Nowlike, utils::calculate_budgets_accrual - }; - - #[test] - fn when_no_budget_updates_then_return_zero() { - let category = Category { - id: 0, - name: String::from("Groceries"), - }; - let budget_updates = []; - - let result = calculate_budgets_accrual(&category, &budget_updates); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_one_budget_update_for_another_category_then_return_zero() { - let category = Category { - id: 0, - name: String::from("Groceries"), - }; - let budget_updates = [BudgetUpdate { - id: 0, - category_id: 1, - date: DateUtc::now(), - new_budget: 100, - new_period: 1, - }]; - - let result = calculate_budgets_accrual(&category, &budget_updates); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_one_budget_update_then_return_quantity_times_days_in_past() { - let category = Category { - id: 0, - name: String::from("Groceries"), - }; - let budget_updates = [BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from(Utc::now().checked_sub_days(Days::new(120)).unwrap()), - new_budget: 100, - new_period: 1, - }]; - - let result = calculate_budgets_accrual(&category, &budget_updates); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 12_000); - } - - #[test] - fn when_two_budget_updates_then_calculates_as_expected() { - let category = Category { - id: 0, - name: String::from("Groceries"), - }; - let budget_updates = [ - BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from(&Utc::now().checked_sub_days(Days::new(60)).unwrap()), - new_budget: 200, - new_period: 1, - }, - BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from(&Utc::now().checked_sub_days(Days::new(120)).unwrap()), - new_budget: 100, - new_period: 1, - }, - ]; - - let result = calculate_budgets_accrual(&category, &budget_updates); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 18_000); - } - - #[test] - fn when_two_budget_updates_on_same_day_then_returns_err() { - let category = Category { - id: 0, - name: String::from("Groceries"), - }; - let budget_updates = [ - BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from_ymd(2020, 12, 25).unwrap(), - new_budget: 200, - new_period: 1, - }, - BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from_ymd(2020, 12, 25).unwrap(), - new_budget: 100, - new_period: 1, - }, - ]; - let mut budget_updates_reversed = budget_updates.clone(); - budget_updates_reversed.reverse(); - - let result_leftways = calculate_budgets_accrual(&category, &budget_updates); - let result_rightways = calculate_budgets_accrual(&category, &budget_updates_reversed); - - assert!(result_leftways.is_err()); - assert!(result_rightways.is_err()); - } -} diff --git a/backend/core/src/utils/calculate_category_balance.rs b/backend/core/src/utils/calculate_category_balance.rs deleted file mode 100644 index 61b94a8..0000000 --- a/backend/core/src/utils/calculate_category_balance.rs +++ /dev/null @@ -1,153 +0,0 @@ -use anyhow::Result; -use crate::{ - models::{budget_update::BudgetUpdate, category::Category}, - utils::{calculate_budgets_accrual, find_by_id_or}, -}; - -pub fn calculate_category_balance( - category: &Category, - transaction_sums: &[(i32, i64)], - category_transfer_from_sums: &[(i32, i64)], - category_transfer_to_sums: &[(i32, i64)], - budget_updates: &[BudgetUpdate], -) -> Result<i64> { - let transaction_sum = find_by_id_or(transaction_sums, category.id, 0); - let category_transfer_from_sum = find_by_id_or(category_transfer_from_sums, category.id, 0); - let category_transfer_to_sum = find_by_id_or(category_transfer_to_sums, category.id, 0); - let budget_accruals_sum = calculate_budgets_accrual(category, budget_updates)?; - - Ok( - transaction_sum - + budget_accruals_sum - + category_transfer_to_sum - - category_transfer_from_sum - ) -} - -#[cfg(test)] -mod test { - use chrono::{Days, Utc}; - - use crate::{ - models::{budget_update::BudgetUpdate, category::Category, date_utc::DateUtc}, - utils::calculate_category_balance - }; - - #[test] - fn when_no_data_then_returns_zero() { - let category = Category { - id: 0, - name: String::new(), - }; - - let result = calculate_category_balance(&category, &[], &[], &[], &[]); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_data_only_for_another_category_then_returns_zero() { - let category = Category { - id: 0, - name: String::new(), - }; - let transaction_sums = [(1, 100)]; - let category_transfer_from_sums = [(1, 91)]; - let category_transfer_to_sums = [(2, 79)]; - let budget_updates = [BudgetUpdate { - id: 0, - category_id: 1, - date: DateUtc::from(Utc::now().checked_sub_days(Days::new(120)).unwrap()), - new_budget: 77, - new_period: 1, - }]; - - let result = calculate_category_balance( - &category, - &transaction_sums, - &category_transfer_from_sums, - &category_transfer_to_sums, - &budget_updates, - ); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_transaction_sum_is_zero_then_returns_zero() { - let category = Category { - id: 0, - name: String::new(), - }; - let transaction_sums = [(0, 0)]; - let category_transfer_from_sums = []; - let category_transfer_to_sums = []; - let budget_updates = []; - - let result = calculate_category_balance( - &category, - &transaction_sums, - &category_transfer_from_sums, - &category_transfer_to_sums, - &budget_updates, - ); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_category_transfers_are_zero_then_returns_zero() { - let category = Category { - id: 0, - name: String::new(), - }; - let transaction_sums = []; - let category_transfer_from_sums = [(0, 0)]; - let category_transfer_to_sums = [(0, 0)]; - let budget_updates = []; - - let result = calculate_category_balance( - &category, - &transaction_sums, - &category_transfer_from_sums, - &category_transfer_to_sums, - &budget_updates, - ); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 0_i64); - } - - #[test] - fn when_some_data_then_calculates_as_expected() { - let category = Category { - id: 0, - name: String::new(), - }; - let transaction_sums = [(0, 100)]; - let category_transfer_from_sums = [(0, 91)]; - let category_transfer_to_sums = [(0, 79)]; - let budget_updates = [BudgetUpdate { - id: 0, - category_id: 0, - date: DateUtc::from(&Utc::now().checked_sub_days(Days::new(120)).unwrap()), - new_budget: 77, - new_period: 1, - }]; - - let result = calculate_category_balance( - &category, - &transaction_sums, - &category_transfer_from_sums, - &category_transfer_to_sums, - &budget_updates, - ); - - let expected_result = 100 + (-91) + 79 + 77 * 120; - assert!(result.is_ok()); - assert_eq!(result.unwrap(), expected_result); - } -} diff --git a/backend/core/src/utils/find_by_id_or.rs b/backend/core/src/utils/find_by_id_or.rs deleted file mode 100644 index 8335e5c..0000000 --- a/backend/core/src/utils/find_by_id_or.rs +++ /dev/null @@ -1,41 +0,0 @@ -pub fn find_by_id_or<Id: PartialEq, Val: Copy>( - arr: &[(Id, Val)], - id: Id, - default: Val, -) -> Val { - arr.iter() - .find(|(elem_id, _)| *elem_id == id) - .map_or(default, |row| row.1) -} - -#[cfg(test)] -mod test { - use super::find_by_id_or; - - #[test] - fn when_no_elements_then_return_default() { - let arr = []; - - let result = find_by_id_or(&arr, 1, 42); - - assert_eq!(result, 42); - } - - #[test] - fn when_id_not_in_elements_then_return_default() { - let arr = [(0, 100), (2, 200)]; - - let result = find_by_id_or(&arr, 1, 42); - - assert_eq!(result, 42); - } - - #[test] - fn when_id_in_elements_then_return_value() { - let arr = [(1, 67)]; - - let result = find_by_id_or(&arr, 1, 42); - - assert_eq!(result, 67); - } -} diff --git a/backend/core/src/utils/mod.rs b/backend/core/src/utils/mod.rs deleted file mode 100644 index 84a27af..0000000 --- a/backend/core/src/utils/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod calculate_budgets_accrual; -mod calculate_category_balance; -mod find_by_id_or; - -pub use calculate_budgets_accrual::calculate_budgets_accrual; -pub use calculate_category_balance::calculate_category_balance; -pub use find_by_id_or::find_by_id_or; diff --git a/backend/core/tests/common/fakes/account.rs b/backend/core/tests/common/fakes/account.rs deleted file mode 100644 index 38422bf..0000000 --- a/backend/core/tests/common/fakes/account.rs +++ /dev/null @@ -1,10 +0,0 @@ -use budgeting_app_core::{models::{account::Account, datetime_utc::DatetimeUtc}, traits::nowlike::Nowlike}; - -pub fn make_fake_account(id: i32) -> Account { - Account { - id, - name: String::from("Joe Bloggs"), - opening_balance: 0, - opening_date: DatetimeUtc::now(), - } -} diff --git a/backend/core/tests/common/fakes/budget_update.rs b/backend/core/tests/common/fakes/budget_update.rs deleted file mode 100644 index f27360f..0000000 --- a/backend/core/tests/common/fakes/budget_update.rs +++ /dev/null @@ -1,16 +0,0 @@ -use budgeting_app_core::{models::{budget_update::{BudgetUpdate, BudgetUpdateBuilder}, date_utc::DateUtc}, traits::nowlike::Nowlike}; - -pub fn make_fake_budget_update(id: i32) -> BudgetUpdate { - make_fake_budget_update_builder(id).build().unwrap() -} - -pub fn make_fake_budget_update_builder(id: i32) -> BudgetUpdateBuilder { - let mut builder = BudgetUpdateBuilder::default(); - builder - .id(id) - .category_id(0) - .date(DateUtc::now()) - .new_budget(0) - .new_period(0); - builder -} diff --git a/backend/core/tests/common/fakes/category.rs b/backend/core/tests/common/fakes/category.rs deleted file mode 100644 index 27a027e..0000000 --- a/backend/core/tests/common/fakes/category.rs +++ /dev/null @@ -1,13 +0,0 @@ -use budgeting_app_core::models::category::{Category, CategoryBuilder}; - -pub fn make_fake_category(id: i32) -> Category { - make_fake_category_builder(id).build().unwrap() -} - -pub fn make_fake_category_builder(id: i32) -> CategoryBuilder { - let mut builder = CategoryBuilder::default(); - builder - .id(id) - .name(String::from("Fake category")); - builder -} diff --git a/backend/core/tests/common/fakes/category_transfer.rs b/backend/core/tests/common/fakes/category_transfer.rs deleted file mode 100644 index 66496f3..0000000 --- a/backend/core/tests/common/fakes/category_transfer.rs +++ /dev/null @@ -1,16 +0,0 @@ -use budgeting_app_core::models::category_transfer::{CategoryTransfer, CategoryTransferBuilder}; - -pub fn make_fake_category_transfer(id: i32) -> CategoryTransfer { - make_fake_category_transfer_builder(id).build().unwrap() -} - -pub fn make_fake_category_transfer_builder(id: i32) -> CategoryTransferBuilder { - let mut builder = CategoryTransferBuilder::default(); - builder - .id(id) - .description(String::from("Fake category transfer")) - .quantity(0) - .from_category_id(0) - .to_category_id(1); - builder -} diff --git a/backend/core/tests/common/fakes/mod.rs b/backend/core/tests/common/fakes/mod.rs deleted file mode 100644 index 68f5209..0000000 --- a/backend/core/tests/common/fakes/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod account; -pub mod budget_update; -pub mod category; -pub mod category_transfer; -pub mod transaction; -pub mod transaction_categorisation; diff --git a/backend/core/tests/common/fakes/transaction.rs b/backend/core/tests/common/fakes/transaction.rs deleted file mode 100644 index 88a9a71..0000000 --- a/backend/core/tests/common/fakes/transaction.rs +++ /dev/null @@ -1,17 +0,0 @@ -use budgeting_app_core::{models::{datetime_utc::DatetimeUtc, transaction::{Transaction, TransactionBuilder}}, traits::nowlike::Nowlike}; - -pub fn make_fake_transaction(id: i32) -> Transaction { - make_fake_transaction_builder(id).build().unwrap() -} - -pub fn make_fake_transaction_builder(id: i32) -> TransactionBuilder { - let mut builder = TransactionBuilder::default(); - builder - .id(id) - .description(String::from("Fake category transfer")) - .payee(String::from("Fake payee")) - .quantity(0) - .date(DatetimeUtc::now()) - .account_id(0); - builder -} diff --git a/backend/core/tests/common/fakes/transaction_categorisation.rs b/backend/core/tests/common/fakes/transaction_categorisation.rs deleted file mode 100644 index 9ddd684..0000000 --- a/backend/core/tests/common/fakes/transaction_categorisation.rs +++ /dev/null @@ -1,16 +0,0 @@ -use budgeting_app_core::models::transaction_categorisation::{TransactionCategorisation, TransactionCategorisationBuilder}; - -pub fn make_fake_transaction_categorisation(id: i32) -> TransactionCategorisation { - make_fake_transaction_categorisation_builder(id).build().unwrap() -} - -pub fn make_fake_transaction_categorisation_builder(id: i32) -> TransactionCategorisationBuilder { - let mut builder = TransactionCategorisationBuilder::default(); - builder - .id(id) - .description(String::from("Fake category transfer")) - .quantity(0) - .transaction_id(0) - .category_id(0); - builder -} diff --git a/backend/core/tests/common/mod.rs b/backend/core/tests/common/mod.rs deleted file mode 100644 index 6681d3d..0000000 --- a/backend/core/tests/common/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod fakes; -pub mod test_context; diff --git a/backend/core/tests/common/test_context.rs b/backend/core/tests/common/test_context.rs deleted file mode 100644 index f6142b0..0000000 --- a/backend/core/tests/common/test_context.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::sync::atomic::{AtomicU64, Ordering}; - -use budgeting_app_core::{queries::clear::clear, MIGRATIONS}; -use diesel::{Connection, SqliteConnection}; -use diesel_migrations::MigrationHarness; - -pub struct TestContext { - pub db_url: String, -} - -static ID_COUNTER: AtomicU64 = AtomicU64::new(0); - -impl TestContext { - pub fn new() -> Self { - let db_url = Self::next_id() + ".sqlite"; - - let connection = &mut SqliteConnection - ::establish(&db_url) - .expect("failed to connect to database"); - - connection - .run_pending_migrations(MIGRATIONS) - .expect("failed to run migrations"); - - clear(connection) - .expect("failed to clear database"); - - Self { - db_url, - } - } - - fn next_id() -> String { - ID_COUNTER.fetch_add(1, Ordering::Relaxed).to_string() - } -} - -impl Drop for TestContext { - fn drop(&mut self) { - std::fs::remove_file(&self.db_url) - .expect(format!("failed to delete database {}", self.db_url).as_str()); - } -} diff --git a/backend/core/tests/main.rs b/backend/core/tests/main.rs deleted file mode 100644 index 27409b6..0000000 --- a/backend/core/tests/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod common; - -mod models; -mod queries; diff --git a/backend/core/tests/models/date_utc.rs b/backend/core/tests/models/date_utc.rs deleted file mode 100644 index 40f8c36..0000000 --- a/backend/core/tests/models/date_utc.rs +++ /dev/null @@ -1,60 +0,0 @@ -use anyhow::Result; -use budgeting_app_core::models::date_utc::DateUtc; -use budgeting_app_core::traits::nowlike::Nowlike; -use diesel::{sql_query, Connection, ExpressionMethods, QueryDsl, RunQueryDsl, Selectable, SelectableHelper, SqliteConnection}; -use diesel::prelude::{Insertable, Queryable}; - -use crate::common::test_context::TestContext; - -diesel::table! { - date_utc_test (id) { - id -> Integer, - date_utc -> Text, - } -} - -#[derive(Insertable, Queryable, Selectable, Clone)] -#[diesel(table_name = date_utc_test)] -pub struct DateUtcTest { - pub id: i32, - pub date_utc: DateUtc, -} - -fn new_test_context() -> Result<TestContext> { - let test_context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&test_context.db_url)?; - let query = "CREATE TABLE date_utc_test(id INTEGER PRIMARY KEY, date_utc TEXT);"; - sql_query(query).execute(connection)?; - Ok(test_context) -} - -fn insert_date_utc(id: i32, date_utc: &DateUtc, connection: &mut SqliteConnection) -> Result<usize> { - let model = DateUtcTest { - id, - date_utc: date_utc.clone(), - }; - let num_rows_inserted = diesel::insert_into(date_utc_test::dsl::date_utc_test) - .values(&[model]) - .execute(connection)?; - Ok(num_rows_inserted) -} - -fn get_date_utc(id: i32, connection: &mut SqliteConnection) -> Result<DateUtcTest> { - let date_utc: Vec<DateUtcTest> = date_utc_test::dsl::date_utc_test - .select(DateUtcTest::as_select()) - .filter(date_utc_test::id.eq(id)) - .load(connection)?; - Ok(date_utc[0].clone()) -} - -#[test] -fn when_insert_date_utc_and_select_then_returns_original_value() -> Result<()> { - let date_utc = DateUtc::now(); - let test_context = new_test_context()?; - let connection = &mut SqliteConnection::establish(&test_context.db_url)?; - let num_rows_inserted = insert_date_utc(0, &date_utc, connection)?; - assert_eq!(num_rows_inserted, 1); - let date_utc_returned = get_date_utc(0, connection)?; - assert_eq!(date_utc_returned.date_utc, date_utc); - Ok(()) -} diff --git a/backend/core/tests/models/datetime_utc.rs b/backend/core/tests/models/datetime_utc.rs deleted file mode 100644 index 7029429..0000000 --- a/backend/core/tests/models/datetime_utc.rs +++ /dev/null @@ -1,60 +0,0 @@ -use anyhow::Result; -use budgeting_app_core::models::datetime_utc::DatetimeUtc; -use budgeting_app_core::traits::nowlike::Nowlike; -use diesel::{sql_query, Connection, ExpressionMethods, QueryDsl, RunQueryDsl, Selectable, SelectableHelper, SqliteConnection}; -use diesel::prelude::{Insertable, Queryable}; - -use crate::common::test_context::TestContext; - -diesel::table! { - datetime_utc_test (id) { - id -> Integer, - datetime_utc -> Text, - } -} - -#[derive(Insertable, Queryable, Selectable, Clone)] -#[diesel(table_name = datetime_utc_test)] -pub struct DatetimeUtcTest { - pub id: i32, - pub datetime_utc: DatetimeUtc, -} - -fn new_test_context() -> Result<TestContext> { - let test_context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&test_context.db_url)?; - let query = "CREATE TABLE datetime_utc_test(id INTEGER PRIMARY KEY, datetime_utc TEXT);"; - sql_query(query).execute(connection)?; - Ok(test_context) -} - -fn insert_datetime_utc(id: i32, datetime_utc: &DatetimeUtc, connection: &mut SqliteConnection) -> Result<usize> { - let model = DatetimeUtcTest { - id, - datetime_utc: datetime_utc.clone(), - }; - let num_rows_inserted = diesel::insert_into(datetime_utc_test::dsl::datetime_utc_test) - .values(&[model]) - .execute(connection)?; - Ok(num_rows_inserted) -} - -fn get_datetime_utc(id: i32, connection: &mut SqliteConnection) -> Result<DatetimeUtcTest> { - let datetime_utc: Vec<DatetimeUtcTest> = datetime_utc_test::dsl::datetime_utc_test - .select(DatetimeUtcTest::as_select()) - .filter(datetime_utc_test::id.eq(id)) - .load(connection)?; - Ok(datetime_utc[0].clone()) -} - -#[test] -fn when_insert_datetime_utc_and_select_then_returns_original_value() -> Result<()> { - let datetime_utc = DatetimeUtc::now(); - let test_context = new_test_context()?; - let connection = &mut SqliteConnection::establish(&test_context.db_url)?; - let num_rows_inserted = insert_datetime_utc(0, &datetime_utc, connection)?; - assert_eq!(num_rows_inserted, 1); - let datetime_utc_returned = get_datetime_utc(0, connection)?; - assert_eq!(datetime_utc_returned.datetime_utc, datetime_utc); - Ok(()) -} diff --git a/backend/core/tests/models/mod.rs b/backend/core/tests/models/mod.rs deleted file mode 100644 index d0d0e4a..0000000 --- a/backend/core/tests/models/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -mod date_utc; -mod datetime_utc; diff --git a/backend/core/tests/queries/account.rs b/backend/core/tests/queries/account.rs deleted file mode 100644 index 4fd9e99..0000000 --- a/backend/core/tests/queries/account.rs +++ /dev/null @@ -1,58 +0,0 @@ -use budgeting_app_core::queries; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::account::make_fake_account, test_context::TestContext}; - -#[test] -fn when_insert_accounts_then_returns_num_accounts() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0), make_fake_account(1)]; - - let num_accounts_inserted = queries::accounts::insert_accounts(&accounts, connection).unwrap(); - - assert_eq!(num_accounts_inserted, 2); -} - -#[test] -fn given_accounts_when_get_all_accounts_then_return_accounts() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0), make_fake_account(1)]; - let _ = queries::accounts::insert_accounts(&accounts, connection).unwrap(); - - let accounts_in_db = queries::accounts::get_all_accounts(connection).unwrap(); - - assert_eq!(accounts_in_db.len(), accounts.len()); - for account in &accounts { - assert!(accounts_in_db.iter().any(|account_in_db| account_in_db.eq(&account))); - } - for account_in_db in accounts_in_db { - assert!(accounts.iter().any(|account| account.eq(&account_in_db))); - } -} - -#[test] -fn given_accounts_when_delete_all_accounts_then_return_num_of_accounts() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0), make_fake_account(1)]; - let _ = queries::accounts::insert_accounts(&accounts, connection).unwrap(); - - let num_accounts_deleted = queries::accounts::delete_all_accounts(connection).unwrap(); - - assert_eq!(num_accounts_deleted, accounts.len()); -} - -#[test] -fn given_deleted_accounts_when_get_all_accounts_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0), make_fake_account(1)]; - let _ = queries::accounts::insert_accounts(&accounts, connection).unwrap(); - let _ = queries::accounts::delete_all_accounts(connection).unwrap(); - - let accounts_returned = queries::accounts::get_all_accounts(connection).unwrap(); - - assert_eq!(accounts_returned.len(), 0); -} diff --git a/backend/core/tests/queries/budget_updates.rs b/backend/core/tests/queries/budget_updates.rs deleted file mode 100644 index 6641b25..0000000 --- a/backend/core/tests/queries/budget_updates.rs +++ /dev/null @@ -1,354 +0,0 @@ -use budgeting_app_core::{models::{category::Category, date_utc::DateUtc}, queries, traits::nowlike::Nowlike}; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::{budget_update::make_fake_budget_update_builder, category::make_fake_category}, test_context::TestContext}; - -fn given_categories(connection: &mut SqliteConnection) -> Vec<Category> { - let categories = vec![make_fake_category(0), make_fake_category(1)]; - let _ = queries::categories::insert_categories(&categories, connection); - categories -} - -#[test] -fn when_insert_budget_updates_then_returns_num_budget_updates() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .category_id(0) - .build().unwrap(), - make_fake_budget_update_builder(1) - .date(DateUtc::from_ymd(2020, 12, 26).unwrap()) - .category_id(0) - .build().unwrap(), - ]; - - let num_budget_updates_inserted = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - assert_eq!(num_budget_updates_inserted, 2); -} - -#[test] -fn given_budget_update_when_insert_budget_update_same_category_and_same_date_then_return_err() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - - let budget_updates_1 = [ - make_fake_budget_update_builder(0) - .category_id(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .build().unwrap() - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates_1, connection); - - let budget_updates_2 = [ - make_fake_budget_update_builder(1) - .category_id(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .build().unwrap() - ]; - let result = queries::budget_updates::insert_budget_updates(&budget_updates_2, connection); - - assert!(result.is_err()); -} - -#[test] -fn given_budget_update_when_insert_budget_update_different_category_and_same_date_then_return_num_budget_updates_inserted() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - - let budget_updates_1 = [ - make_fake_budget_update_builder(0) - .category_id(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .build().unwrap() - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates_1, connection); - - let budget_updates_2 = [ - make_fake_budget_update_builder(1) - .category_id(1) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .build().unwrap() - ]; - let result = queries::budget_updates::insert_budget_updates(&budget_updates_2, connection); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 1); -} - -#[test] -fn given_budget_update_when_insert_budget_update_same_category_and_different_date_then_return_num_budget_updates_inserted() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - - let budget_updates_1 = [ - make_fake_budget_update_builder(0) - .category_id(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .build().unwrap() - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates_1, connection); - - let budget_updates_2 = [ - make_fake_budget_update_builder(1) - .category_id(0) - .date(DateUtc::from_ymd(2020, 12, 26).unwrap()) - .build().unwrap() - ]; - let result = queries::budget_updates::insert_budget_updates(&budget_updates_2, connection); - - assert!(result.is_ok()); - assert_eq!(result.unwrap(), 1); -} - -#[test] -fn given_budget_updates_when_get_all_budget_updates_then_return_budget_updates() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .category_id(0) - .build().unwrap(), - make_fake_budget_update_builder(1) - .date(DateUtc::from_ymd(2020, 12, 26).unwrap()) - .category_id(0) - .build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - let budget_updates_in_db = queries::budget_updates::get_all_budget_updates(connection).unwrap(); - - assert_eq!(budget_updates_in_db.len(), budget_updates.len()); - assert_eq!(budget_updates_in_db[0], budget_updates[0]); - assert_eq!(budget_updates_in_db[1], budget_updates[1]); - for budget_update in &budget_updates { - assert!(budget_updates_in_db.iter().any(|budget_update_in_db| budget_update_in_db.eq(&budget_update))); - } - for budget_update_in_db in budget_updates_in_db { - assert!(budget_updates.iter().any(|budget_update| budget_update.eq(&budget_update_in_db))); - } -} - -#[test] -fn given_budget_updates_when_delete_all_budget_updates_then_return_num_of_budget_updates() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .category_id(0) - .build().unwrap(), - make_fake_budget_update_builder(1) - .date(DateUtc::from_ymd(2020, 12, 26).unwrap()) - .category_id(0) - .build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - let num_budget_updates_deleted = queries::budget_updates::delete_all_budget_updates(connection).unwrap(); - - assert_eq!(num_budget_updates_deleted, budget_updates.len()); -} - -#[test] -fn given_deleted_budget_updates_when_get_all_budget_updates_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .date(DateUtc::from_ymd(2020, 12, 25).unwrap()) - .category_id(0) - .build().unwrap(), - make_fake_budget_update_builder(1) - .date(DateUtc::from_ymd(2020, 12, 26).unwrap()) - .category_id(0) - .build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - let _ = queries::budget_updates::delete_all_budget_updates(connection).unwrap(); - - let budget_updates_returned = queries::budget_updates::get_all_budget_updates(connection).unwrap(); - - assert_eq!(budget_updates_returned.len(), 0); -} - -#[test] -fn given_no_categories_when_get_first_with_date_and_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &DateUtc::now(), - 0, - connection, - ).unwrap(); - - assert!(first_with_date_and_category_id.is_none()); -} - -#[test] -fn given_no_budget_updates_when_get_first_with_date_and_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &DateUtc::now(), - 0, - connection, - ).unwrap(); - - assert!(first_with_date_and_category_id.is_none()); -} - -#[test] -fn given_budget_update_when_get_first_with_date_then_return_budget_update() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let date: DateUtc = "2024-10-28".parse().unwrap(); - let budget_update = make_fake_budget_update_builder(0).date(date.clone()).build().unwrap(); - let _ = queries::budget_updates::insert_budget_updates(&[budget_update.clone()], connection).unwrap(); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &date, - 0, - connection, - ).unwrap(); - - assert!(first_with_date_and_category_id.is_some()); - assert_eq!(first_with_date_and_category_id.unwrap(), budget_update); -} - -#[test] -fn given_budget_update_when_get_first_with_date_and_different_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let date: DateUtc = "2024-10-28".parse().unwrap(); - let different_date: DateUtc = "2024-10-29".parse().unwrap(); - let budget_update = make_fake_budget_update_builder(0).date(date.clone()).build().unwrap(); - let _ = queries::budget_updates::insert_budget_updates(&[budget_update.clone()], connection).unwrap(); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &different_date, - 2, - connection - ).unwrap(); - - assert!(first_with_date_and_category_id.is_none()); -} - -#[test] -fn given_budget_update_when_get_first_with_different_date_and_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let date: DateUtc = "2024-10-28".parse().unwrap(); - let different_date: DateUtc = "2024-10-29".parse().unwrap(); - let budget_update = make_fake_budget_update_builder(0).date(date.clone()).build().unwrap(); - let _ = queries::budget_updates::insert_budget_updates(&[budget_update.clone()], connection).unwrap(); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &different_date, - 0, - connection - ).unwrap(); - - assert!(first_with_date_and_category_id.is_none()); -} - -#[test] -fn given_many_budget_updates_when_get_first_with_date_and_category_id_then_return_any_with_date() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0).date("2024-12-25".parse().unwrap()).category_id(0).build().unwrap(), - make_fake_budget_update_builder(1).date("2024-12-25".parse().unwrap()).category_id(1).build().unwrap(), - make_fake_budget_update_builder(2).date("2020-12-26".parse().unwrap()).category_id(0).build().unwrap(), - make_fake_budget_update_builder(3).date("2020-12-26".parse().unwrap()).category_id(1).build().unwrap(), - make_fake_budget_update_builder(4).date("2020-12-27".parse().unwrap()).category_id(0).build().unwrap(), - make_fake_budget_update_builder(5).date("2020-12-27".parse().unwrap()).category_id(1).build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - let first_with_date_and_category_id = - queries::budget_updates::get_first_budget_update_with_date_and_category_id( - &"2024-12-25".parse().unwrap(), - 0, - connection, - ).unwrap(); - - assert!(first_with_date_and_category_id.is_some()); - assert_eq!(first_with_date_and_category_id.unwrap(), budget_updates[0]); -} - -#[test] -fn given_many_budget_updates_when_get_most_recent_with_category_id_then_return_correct_date() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .category_id(0) - .date("2024-12-25".parse().unwrap()) - .build().unwrap(), - make_fake_budget_update_builder(1) - .category_id(0) - .date("2020-12-26".parse().unwrap()) - .build().unwrap(), - make_fake_budget_update_builder(2) - .category_id(1) - .date("2020-12-27".parse().unwrap()) - .build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - let most_recent_with_category = queries::budget_updates::get_most_recent_budget_update_date_with_category_id( - 0, connection, - ); - - assert!(most_recent_with_category.is_ok()); - let most_recent_with_category = most_recent_with_category.unwrap(); - assert!(most_recent_with_category .is_some()); - let most_recent_with_category = most_recent_with_category.unwrap(); - assert_eq!(most_recent_with_category, budget_updates[1].date); -} - -#[test] -fn given_budget_update_when_get_most_recent_with_different_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let _categories = given_categories(connection); - let budget_updates = [ - make_fake_budget_update_builder(0) - .category_id(1) - .date("2020-12-27".parse().unwrap()) - .build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection).unwrap(); - - let most_recent_with_category = queries::budget_updates::get_most_recent_budget_update_date_with_category_id( - 0, connection, - ); - - assert!(most_recent_with_category.is_ok()); - let most_recent_with_category = most_recent_with_category.unwrap(); - assert!(most_recent_with_category .is_none()); -} diff --git a/backend/core/tests/queries/categories.rs b/backend/core/tests/queries/categories.rs deleted file mode 100644 index 4ab3f68..0000000 --- a/backend/core/tests/queries/categories.rs +++ /dev/null @@ -1,218 +0,0 @@ -use budgeting_app_core::{models::{account::Account, budget::Budget, budget_update::BudgetUpdate, category::Category, date_utc::DateUtc, transaction::Transaction, transaction_categorisation::TransactionCategorisation}, queries}; -use chrono::{Days, Utc}; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::{account::make_fake_account, budget_update::make_fake_budget_update_builder, category::make_fake_category, transaction::make_fake_transaction_builder, transaction_categorisation::make_fake_transaction_categorisation_builder}, test_context::TestContext}; - -fn given_categories(connection: &mut SqliteConnection) -> Vec<Category> { - let categories = vec![make_fake_category(0), make_fake_category(1)]; - let _ = queries::categories::insert_categories(&categories, connection).unwrap(); - categories -} - -fn given_transactions(connection: &mut SqliteConnection) -> Vec<Transaction> { - let transactions = vec![ - make_fake_transaction_builder(0).quantity(1).build().unwrap(), - make_fake_transaction_builder(1).quantity(2).build().unwrap(), - make_fake_transaction_builder(2).quantity(4).build().unwrap(), - make_fake_transaction_builder(3).quantity(8).build().unwrap(), - ]; - let _ = queries::transactions::insert_transactions(&transactions, connection).unwrap(); - transactions -} - -fn given_accounts(connection: &mut SqliteConnection) -> Vec<Account> { - let accounts = vec![ - make_fake_account(0), - ]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - accounts -} - -fn given_transaction_categorisations(connection: &mut SqliteConnection) -> Vec<TransactionCategorisation> { - let transaction_categorisations = vec![ - make_fake_transaction_categorisation_builder(0).quantity(1).transaction_id(0).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(1).quantity(1).transaction_id(1).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(2).quantity(1).transaction_id(1).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(3).quantity(4).transaction_id(2).category_id(1).build().unwrap(), - make_fake_transaction_categorisation_builder(4).quantity(3).transaction_id(3).category_id(1).build().unwrap(), - make_fake_transaction_categorisation_builder(5).quantity(5).transaction_id(3).category_id(1).build().unwrap(), - ]; - let _ = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection).unwrap(); - transaction_categorisations -} - -fn given_budget_updates(connection: &mut SqliteConnection) -> Vec<BudgetUpdate> { - let now = Utc::now(); - let twenty_days_ago = DateUtc::from(now.checked_sub_days(Days::new(20)).unwrap()); - let ten_days_ago = DateUtc::from(now.checked_sub_days(Days::new(10)).unwrap()); - let budget_updates = vec![ - make_fake_budget_update_builder(0).category_id(0).date(twenty_days_ago.clone()).new_budget(100).new_period(1).build().unwrap(), - make_fake_budget_update_builder(1).category_id(0).date(ten_days_ago.clone()).new_budget(50).new_period(2).build().unwrap(), - make_fake_budget_update_builder(2).category_id(1).date(twenty_days_ago.clone()).new_budget(90).new_period(4).build().unwrap(), - make_fake_budget_update_builder(3).category_id(1).date(ten_days_ago.clone()).new_budget(40).new_period(8).build().unwrap(), - ]; - let _ = queries::budget_updates::insert_budget_updates(&budget_updates, connection); - budget_updates -} - -#[test] -fn when_insert_categories_then_returns_num_categories() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - - let num_categories_inserted = queries::categories::insert_categories(&categories, connection).unwrap(); - - assert_eq!(num_categories_inserted, 2); -} - -#[test] -fn given_categories_when_get_all_categories_then_return_categories() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - - let categories_in_db = queries::categories::get_all_categories(connection).unwrap(); - - assert_eq!(categories_in_db.len(), categories.len()); - for category in &categories { - assert!(categories_in_db.iter().any(|category_in_db| category_in_db.eq(&category))); - } - for category_in_db in categories_in_db { - assert!(categories.iter().any(|category| category.eq(&category_in_db))); - } -} - -#[test] -fn given_categories_when_delete_all_categories_then_return_num_of_categories() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - - let num_categories_deleted = queries::categories::delete_all_categories(connection).unwrap(); - - assert_eq!(num_categories_deleted, categories.len()); -} - -#[test] -fn given_deleted_categories_when_get_all_categories_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_categories(connection); - let _ = queries::categories::delete_all_categories(connection).unwrap(); - - let categories_returned = queries::categories::get_all_categories(connection).unwrap(); - - assert_eq!(categories_returned.len(), 0); -} - -#[test] -fn given_categories_and_no_transactions_when_get_all_balances_then_return_all_zero() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_categories(connection); - - let balances = queries::categories::get_all_category_balances(connection); - - assert!(balances.is_ok()); - let mut balances = balances.unwrap(); - balances.sort_by(|b1, b2| b1.category_id.cmp(&b2.category_id)); - assert_eq!(balances.len(), 2); - for balance in balances { - assert_eq!(0, balance.balance); - } -} - -#[test] -fn given_categories_and_transaction_categorisations_when_get_all_balances_then_return_balances() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - let _accounts = given_accounts(connection); - let _transactions = given_transactions(connection); - let transaction_categorisations = given_transaction_categorisations(connection); - - let balances = queries::categories::get_all_category_balances(connection); - - assert!(balances.is_ok()); - let mut balances = balances.unwrap(); - balances.sort_by(|b1, b2| b1.category_id.cmp(&b2.category_id)); - assert_eq!(balances.len(), categories.len()); - for category in categories { - let balance = balances.iter().find(|b| b.category_id == category.id).unwrap(); - let expected_balance: i32 = transaction_categorisations - .iter() - .filter(|t| t.category_id == category.id) - .map(|t| t.quantity) - .sum(); - assert_eq!(expected_balance, balance.balance); - } -} - -#[test] -fn given_categories_when_get_all_ids_then_return_all_ids() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - - let ids = queries::categories::get_all_category_ids(connection).unwrap(); - - assert_eq!(categories.len(), ids.len()); - for category in &categories { - assert!(ids.iter().any(|id| category.id == *id)); - } - for id in ids { - assert!(categories.iter().any(|category| category.id == id)); - } -} - -#[test] -fn given_categories_and_no_budget_updates_when_get_most_recent_budget_per_category_id_then_return_none() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - - let most_recent_budget_per_category_id = queries::categories::get_most_recent_category_budget_per_category_id(connection); - - assert!(most_recent_budget_per_category_id.is_ok()); - let most_recent_budget_per_category_id = most_recent_budget_per_category_id.unwrap(); - assert_eq!(categories.len(), most_recent_budget_per_category_id.len()); - for category in categories { - let most_recent_budget = most_recent_budget_per_category_id.iter().find(|b| b.category_id == category.id); - assert!(most_recent_budget.is_some()); - let most_recent_budget = most_recent_budget.unwrap(); - assert!(most_recent_budget.budget.is_none()); - } -} - -#[test] -fn given_categories_and_budget_updates_when_get_most_recent_budget_per_category_id_then_return_most_recent_budget() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = given_categories(connection); - let budget_updates = given_budget_updates(connection); - - let most_recent_budget_per_category_id = queries::categories::get_most_recent_category_budget_per_category_id(connection); - - assert!(most_recent_budget_per_category_id.is_ok()); - let most_recent_budget_per_category_id = most_recent_budget_per_category_id.unwrap(); - assert_eq!(categories.len(), most_recent_budget_per_category_id.len()); - for category in categories { - let most_recent_budget_update = budget_updates - .iter() - .filter(|bu| bu.category_id == category.id) - .max_by_key(|bu| bu.date.clone()) - .unwrap(); - - let most_recent_budget = most_recent_budget_per_category_id.iter().find(|b| b.category_id == category.id); - assert!(most_recent_budget.is_some()); - let most_recent_budget = most_recent_budget.unwrap(); - assert!(most_recent_budget.budget.is_some()); - let most_recent_budget = most_recent_budget.budget.unwrap(); - assert_eq!(most_recent_budget, Budget { - quantity: most_recent_budget_update.new_budget, - period: most_recent_budget_update.new_period, - }); - } -} diff --git a/backend/core/tests/queries/category_transfers.rs b/backend/core/tests/queries/category_transfers.rs deleted file mode 100644 index 0df144f..0000000 --- a/backend/core/tests/queries/category_transfers.rs +++ /dev/null @@ -1,124 +0,0 @@ -use budgeting_app_core::queries; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::{category::make_fake_category, category_transfer::make_fake_category_transfer_builder}, test_context::TestContext}; - -#[test] -fn when_insert_category_transfers_then_returns_num_category_transfers() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - - let num_category_transfers_inserted = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - - assert_eq!(num_category_transfers_inserted, 2); -} - -#[test] -fn given_category_transfers_when_get_all_category_transfers_then_return_category_transfers() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - let _ = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - - let category_transfers_in_db = queries::category_transfers::get_all_category_transfers(connection).unwrap(); - - assert_eq!(category_transfers_in_db.len(), category_transfers.len()); - for category_transfer in &category_transfers { - assert!(category_transfers_in_db.iter().any(|category_transfer_in_db| category_transfer_in_db.eq(&category_transfer))); - } - for category_transfer_in_db in category_transfers_in_db { - assert!(category_transfers.iter().any(|category_transfer| category_transfer.eq(&category_transfer_in_db))); - } -} - -#[test] -fn given_category_transfers_when_delete_all_category_transfers_then_return_num_of_category_transfers() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - let _ = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - - let num_category_transfers_deleted = queries::category_transfers::delete_all_category_transfers(connection).unwrap(); - - assert_eq!(num_category_transfers_deleted, category_transfers.len()); -} - -#[test] -fn given_deleted_category_transfers_when_get_all_category_transfers_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - let _ = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - let _ = queries::category_transfers::delete_all_category_transfers(connection).unwrap(); - - let category_transfers_returned = queries::category_transfers::get_all_category_transfers(connection).unwrap(); - - assert_eq!(category_transfers_returned.len(), 0); -} - -#[test] -fn given_category_transfers_when_sum_quantity_per_from_category_id_then_returns_sum_per_from_category_id() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).quantity(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).quantity(2).build().unwrap(), - make_fake_category_transfer_builder(2).from_category_id(1).to_category_id(0).quantity(4).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - let _ = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - - let sums = queries::category_transfers::sum_category_transfer_quantity_per_from_category_id(connection); - - assert!(sums.is_ok()); - let mut sums = sums.unwrap(); - sums.sort_by_key(|sum| sum.0); - assert_eq!(categories.len(), sums.len()); - assert_eq!(3, sums[0].1); - assert_eq!(4, sums[1].1); -} - -#[test] -fn given_category_transfers_when_sum_quantity_per_to_category_id_then_returns_sum_per_to_category_id() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let categories = [make_fake_category(0), make_fake_category(1)]; - let category_transfers = [ - make_fake_category_transfer_builder(0).from_category_id(0).to_category_id(1).quantity(1).build().unwrap(), - make_fake_category_transfer_builder(1).from_category_id(0).to_category_id(1).quantity(2).build().unwrap(), - make_fake_category_transfer_builder(2).from_category_id(1).to_category_id(0).quantity(4).build().unwrap(), - ]; - let _ = queries::categories::insert_categories(&categories, connection); - let _ = queries::category_transfers::insert_category_transfers(&category_transfers, connection).unwrap(); - - let sums = queries::category_transfers::sum_category_transfer_quantity_per_to_category_id(connection); - - assert!(sums.is_ok()); - let mut sums = sums.unwrap(); - sums.sort_by_key(|sum| sum.0); - assert_eq!(categories.len(), sums.len()); - assert_eq!(4, sums[0].1); - assert_eq!(3, sums[1].1); -} diff --git a/backend/core/tests/queries/mod.rs b/backend/core/tests/queries/mod.rs deleted file mode 100644 index e421934..0000000 --- a/backend/core/tests/queries/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod account; -mod budget_updates; -mod categories; -mod category_transfers; -mod transaction_categorisations; -mod transactions; diff --git a/backend/core/tests/queries/transaction_categorisations.rs b/backend/core/tests/queries/transaction_categorisations.rs deleted file mode 100644 index 123ee6e..0000000 --- a/backend/core/tests/queries/transaction_categorisations.rs +++ /dev/null @@ -1,127 +0,0 @@ -use budgeting_app_core::{models::{account::Account, category::Category, transaction::Transaction}, queries}; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::{account::make_fake_account, category::make_fake_category, transaction::make_fake_transaction_builder, transaction_categorisation::make_fake_transaction_categorisation_builder}, test_context::TestContext}; - -fn given_accounts(connection: &mut SqliteConnection) -> Vec<Account> { - let accounts = vec![make_fake_account(0)]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - accounts -} - -fn given_categories(connection: &mut SqliteConnection) -> Vec<Category> { - let categories = vec![make_fake_category(0), make_fake_category(1)]; - let _ = queries::categories::insert_categories(&categories, connection); - categories -} - -fn given_transactions(connection: &mut SqliteConnection) -> Vec<Transaction> { - let transactions = vec![ - make_fake_transaction_builder(0).account_id(0).build().unwrap(), - make_fake_transaction_builder(1).account_id(0).build().unwrap(), - ]; - let _ = queries::transactions::insert_transactions(&transactions, connection); - transactions -} - -#[test] -fn when_insert_transaction_categorisations_then_returns_num_transaction_categorisations() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_accounts(connection); - given_categories(connection); - given_transactions(connection); - let transaction_categorisations = [ - make_fake_transaction_categorisation_builder(0).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(1).category_id(0).build().unwrap(), - ]; - - let num_transaction_categorisations_inserted = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection).unwrap(); - - assert_eq!(num_transaction_categorisations_inserted, 2); -} - -#[test] -fn given_transaction_categorisations_when_get_all_transaction_categorisations_then_return_transaction_categorisations() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_accounts(connection); - given_categories(connection); - given_transactions(connection); - let transaction_categorisations = [ - make_fake_transaction_categorisation_builder(0).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(1).category_id(0).build().unwrap(), - ]; - let _ = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection); - - let transaction_categorisations_in_db = queries::transaction_categorisations::get_all_transaction_categorisations(connection).unwrap(); - - assert_eq!(transaction_categorisations_in_db.len(), transaction_categorisations.len()); - for transaction_categorisation in &transaction_categorisations { - assert!(transaction_categorisations_in_db.iter().any(|transaction_categorisation_in_db| transaction_categorisation_in_db.eq(&transaction_categorisation))); - } - for transaction_categorisation_in_db in transaction_categorisations_in_db { - assert!(transaction_categorisations.iter().any(|transaction_categorisation| transaction_categorisation.eq(&transaction_categorisation_in_db))); - } -} - -#[test] -fn given_transaction_categorisations_when_delete_all_transaction_categorisations_then_return_num_of_transaction_categorisations() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_accounts(connection); - given_categories(connection); - given_transactions(connection); - let transaction_categorisations = [ - make_fake_transaction_categorisation_builder(0).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(1).category_id(0).build().unwrap(), - ]; - let _ = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection); - - let num_transaction_categorisations_deleted = queries::transaction_categorisations::delete_all_transaction_categorisations(connection).unwrap(); - - assert_eq!(num_transaction_categorisations_deleted, transaction_categorisations.len()); -} - -#[test] -fn given_deleted_transaction_categorisations_when_get_all_transaction_categorisations_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_accounts(connection); - given_categories(connection); - given_transactions(connection); - let transaction_categorisations = [ - make_fake_transaction_categorisation_builder(0).category_id(0).build().unwrap(), - make_fake_transaction_categorisation_builder(1).category_id(0).build().unwrap(), - ]; - let _ = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection); - let _ = queries::transaction_categorisations::delete_all_transaction_categorisations(connection); - - let transaction_categorisations_returned = queries::transaction_categorisations::get_all_transaction_categorisations(connection).unwrap(); - - assert_eq!(transaction_categorisations_returned.len(), 0); -} - -#[test] -fn given_transaction_categorisations_when_sum_quantity_per_category_id_then_returns_sum_quantity_per_category_id() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - given_accounts(connection); - let categories = given_categories(connection); - given_transactions(connection); - let transaction_categorisations = [ - make_fake_transaction_categorisation_builder(0).category_id(0).quantity(1).build().unwrap(), - make_fake_transaction_categorisation_builder(1).category_id(0).quantity(2).build().unwrap(), - make_fake_transaction_categorisation_builder(2).category_id(1).quantity(4).build().unwrap(), - ]; - let _ = queries::transaction_categorisations::insert_transaction_categorisations(&transaction_categorisations, connection); - - let sums = queries::transaction_categorisations::sum_transaction_categorisation_quantity_per_category_id(connection); - - assert!(sums.is_ok()); - let mut sums = sums.unwrap(); - sums.sort_by_key(|sum| sum.0); - assert_eq!(categories.len(), sums.len()); - assert_eq!(3, sums[0].1); - assert_eq!(4, sums[1].1); -} diff --git a/backend/core/tests/queries/transactions.rs b/backend/core/tests/queries/transactions.rs deleted file mode 100644 index 406f5a8..0000000 --- a/backend/core/tests/queries/transactions.rs +++ /dev/null @@ -1,78 +0,0 @@ -use budgeting_app_core::queries; -use diesel::{Connection, SqliteConnection}; - -use crate::common::{fakes::{account::make_fake_account, transaction::make_fake_transaction_builder}, test_context::TestContext}; - -#[test] -fn when_insert_transactions_then_returns_num_transactions() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0)]; - let transactions = [ - make_fake_transaction_builder(0).account_id(0).build().unwrap(), - make_fake_transaction_builder(1).account_id(0).build().unwrap(), - ]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - - let num_transactions_inserted = queries::transactions::insert_transactions(&transactions, connection).unwrap(); - - assert_eq!(num_transactions_inserted, 2); -} - -#[test] -fn given_transactions_when_get_all_transactions_then_return_transactions() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0)]; - let transactions = [ - make_fake_transaction_builder(0).account_id(0).build().unwrap(), - make_fake_transaction_builder(1).account_id(0).build().unwrap(), - ]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - let _ = queries::transactions::insert_transactions(&transactions, connection).unwrap(); - - let transactions_in_db = queries::transactions::get_all_transactions(connection).unwrap(); - - assert_eq!(transactions_in_db.len(), transactions.len()); - for transaction in &transactions { - assert!(transactions_in_db.iter().any(|transaction_in_db| transaction_in_db.eq(&transaction))); - } - for transaction_in_db in transactions_in_db { - assert!(transactions.iter().any(|transaction| transaction.eq(&transaction_in_db))); - } -} - -#[test] -fn given_transactions_when_delete_all_transactions_then_return_num_of_transactions() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0)]; - let transactions = [ - make_fake_transaction_builder(0).account_id(0).build().unwrap(), - make_fake_transaction_builder(1).account_id(0).build().unwrap(), - ]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - let _ = queries::transactions::insert_transactions(&transactions, connection).unwrap(); - - let num_transactions_deleted = queries::transactions::delete_all_transactions(connection).unwrap(); - - assert_eq!(num_transactions_deleted, transactions.len()); -} - -#[test] -fn given_deleted_transactions_when_get_all_transactions_then_return_empty() { - let context = TestContext::new(); - let connection = &mut SqliteConnection::establish(&context.db_url).unwrap(); - let accounts = [make_fake_account(0)]; - let transactions = [ - make_fake_transaction_builder(0).account_id(0).build().unwrap(), - make_fake_transaction_builder(1).account_id(0).build().unwrap(), - ]; - let _ = queries::accounts::insert_accounts(&accounts, connection); - let _ = queries::transactions::insert_transactions(&transactions, connection).unwrap(); - let _ = queries::transactions::delete_all_transactions(connection).unwrap(); - - let transactions_returned = queries::transactions::get_all_transactions(connection).unwrap(); - - assert_eq!(transactions_returned.len(), 0); -} |
