complete redesign
163
Cargo.lock
generated
@@ -99,9 +99,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.95"
|
||||
version = "1.0.96"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
||||
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
@@ -284,9 +284,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.14"
|
||||
version = "1.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
|
||||
checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
@@ -314,9 +314,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.29"
|
||||
version = "4.5.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8acebd8ad879283633b343856142139f2da2317c96b05b4dd6181c61e2480184"
|
||||
checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -324,9 +324,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.29"
|
||||
version = "4.5.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ba32cbda51c7e1dfd49acc1457ba1a7dec5b64fe360e828acb13ca8dc9c2f9"
|
||||
checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -352,12 +352,50 @@ version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
||||
|
||||
[[package]]
|
||||
name = "client"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"common",
|
||||
"console",
|
||||
"crossterm",
|
||||
"dialoguer",
|
||||
"dirs",
|
||||
"dotenvy",
|
||||
"prost",
|
||||
"ratatui",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
"toml",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"tonic-reflection",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"prost",
|
||||
"serde",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "compact_str"
|
||||
version = "0.8.1"
|
||||
@@ -626,9 +664,9 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
@@ -834,9 +872,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
|
||||
checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
@@ -1329,9 +1367,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.25"
|
||||
version = "0.4.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
|
||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
@@ -1372,9 +1410,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b"
|
||||
checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
@@ -1391,32 +1429,6 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multieko2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"console",
|
||||
"crossterm",
|
||||
"dialoguer",
|
||||
"dirs",
|
||||
"dotenvy",
|
||||
"prost",
|
||||
"ratatui",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
"toml",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"tonic-reflection",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multimap"
|
||||
version = "0.10.0"
|
||||
@@ -1425,9 +1437,9 @@ checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03"
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dab59f8e050d5df8e4dd87d9206fb6f65a483e20ac9fda365ade4fab353196c"
|
||||
checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
@@ -1841,9 +1853,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.8"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
|
||||
checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
@@ -1979,18 +1991,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.217"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.217"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1999,9 +2011,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.138"
|
||||
version = "1.0.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949"
|
||||
checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
@@ -2060,6 +2072,33 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "server"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"common",
|
||||
"console",
|
||||
"crossterm",
|
||||
"dialoguer",
|
||||
"dirs",
|
||||
"dotenvy",
|
||||
"prost",
|
||||
"ratatui",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
"toml",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"tonic-reflection",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
@@ -2154,9 +2193,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -2473,9 +2512,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.16.0"
|
||||
version = "3.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91"
|
||||
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
@@ -2847,9 +2886,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
@@ -2859,9 +2898,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.16"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
|
||||
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@@ -3233,9 +3272,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603"
|
||||
checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
32
Cargo.toml
@@ -1,29 +1,3 @@
|
||||
[package]
|
||||
name = "multieko2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "0.4.39", features = ["serde"] }
|
||||
clap = { version = "4.5.29", features = ["derive"] }
|
||||
console = "0.15.10"
|
||||
crossterm = "0.28.1"
|
||||
dialoguer = "0.11.0"
|
||||
dirs = "6.0.0"
|
||||
dotenvy = "0.15.7"
|
||||
prost = "0.13.5"
|
||||
ratatui = "0.29.0"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
serde_json = "1.0.138"
|
||||
serde_with = "3.12.0"
|
||||
sqlx = { version = "0.8.3", features = ["chrono", "postgres", "runtime-tokio", "runtime-tokio-native-tls", "time"] }
|
||||
tokio = { version = "1.43.0", features = ["full", "macros"] }
|
||||
toml = "0.8.20"
|
||||
tonic = "0.12.3"
|
||||
tonic-build = "0.12.3"
|
||||
tonic-reflection = "0.12.3"
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.12"
|
||||
[workspace]
|
||||
members = ["client", "server", "common"]
|
||||
resolver = "2"
|
||||
|
||||
28
client/Cargo.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[package]
|
||||
name = "client"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
common = { path = "../common" }
|
||||
|
||||
chrono = { version = "0.4.39", features = ["serde"] }
|
||||
clap = { version = "4.5.29", features = ["derive"] }
|
||||
console = "0.15.10"
|
||||
crossterm = "0.28.1"
|
||||
dialoguer = "0.11.0"
|
||||
dirs = "6.0.0"
|
||||
dotenvy = "0.15.7"
|
||||
prost = "0.13.5"
|
||||
ratatui = "0.29.0"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
serde_json = "1.0.138"
|
||||
serde_with = "3.12.0"
|
||||
sqlx = { version = "0.8.3", features = ["chrono", "postgres", "runtime-tokio", "runtime-tokio-native-tls", "time"] }
|
||||
tokio = { version = "1.43.0", features = ["full", "macros"] }
|
||||
toml = "0.8.20"
|
||||
tonic = "0.12.3"
|
||||
tonic-build = "0.12.3"
|
||||
tonic-reflection = "0.12.3"
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
3
client/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Client is running!");
|
||||
}
|
||||
@@ -10,11 +10,11 @@ use std::io::{self, stdout};
|
||||
use tonic::transport::Channel;
|
||||
|
||||
// Import the correct clients and proto messages from their respective modules
|
||||
use crate::proto::multieko2::adresar::adresar_client::AdresarClient;
|
||||
use crate::proto::multieko2::adresar::{AdresarResponse, PostAdresarRequest, PutAdresarRequest};
|
||||
use crate::proto::multieko2::common::{CountResponse, PositionRequest, Empty};
|
||||
use crate::proto::multieko2::table_structure::table_structure_service_client::TableStructureServiceClient;
|
||||
use crate::proto::multieko2::table_structure::TableStructureResponse;
|
||||
use common::proto::multieko2::adresar::adresar_client::AdresarClient;
|
||||
use common::proto::multieko2::adresar::{AdresarResponse, PostAdresarRequest, PutAdresarRequest};
|
||||
use common::proto::multieko2::common::{CountResponse, PositionRequest, Empty};
|
||||
use common::proto::multieko2::table_structure::table_structure_service_client::TableStructureServiceClient;
|
||||
use common::proto::multieko2::table_structure::TableStructureResponse;
|
||||
|
||||
pub struct AppTerminal {
|
||||
terminal: Terminal<CrosstermBackend<io::Stdout>>,
|
||||
@@ -4,7 +4,7 @@ use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use crossterm::cursor::{SetCursorStyle};
|
||||
use crate::client::terminal::AppTerminal;
|
||||
use crate::client::config::Config;
|
||||
use crate::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
|
||||
use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
|
||||
use super::form::FormState;
|
||||
|
||||
pub struct EventHandler {
|
||||
13
common/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "common"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tonic = "0.12.3"
|
||||
prost = "0.13.5"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
chrono = { version = "0.4.39", features = ["serde"] }
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.12.3"
|
||||
@@ -2,8 +2,9 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::configure()
|
||||
.build_server(true)
|
||||
.out_dir("src/proto")
|
||||
.file_descriptor_set_path("src/proto/descriptor.bin")
|
||||
.compile_protos(
|
||||
.compile(
|
||||
&[
|
||||
"proto/common.proto",
|
||||
"proto/adresar.proto",
|
||||
7
common/src/lib.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// common/src/lib.rs
|
||||
pub mod proto {
|
||||
include!("proto/multieko2.adresar.rs");
|
||||
include!("proto/multieko2.common.rs");
|
||||
include!("proto/multieko2.table_structure.rs");
|
||||
include!("proto/multieko2.uctovnictvo.rs");
|
||||
}
|
||||
3356
server/Cargo.lock
generated
Normal file
28
server/Cargo.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[package]
|
||||
name = "server"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
common = { path = "../common" }
|
||||
|
||||
chrono = { version = "0.4.39", features = ["serde"] }
|
||||
clap = { version = "4.5.29", features = ["derive"] }
|
||||
console = "0.15.10"
|
||||
crossterm = "0.28.1"
|
||||
dialoguer = "0.11.0"
|
||||
dirs = "6.0.0"
|
||||
dotenvy = "0.15.7"
|
||||
prost = "0.13.5"
|
||||
ratatui = "0.29.0"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
serde_json = "1.0.138"
|
||||
serde_with = "3.12.0"
|
||||
sqlx = { version = "0.8.3", features = ["chrono", "postgres", "runtime-tokio", "runtime-tokio-native-tls", "time"] }
|
||||
tokio = { version = "1.43.0", features = ["full", "macros"] }
|
||||
toml = "0.8.20"
|
||||
tonic = "0.12.3"
|
||||
tonic-build = "0.12.3"
|
||||
tonic-reflection = "0.12.3"
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
@@ -1,7 +1,7 @@
|
||||
// src/adresar/handlers/delete_adresar.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::adresar::{DeleteAdresarRequest, DeleteAdresarResponse};
|
||||
use common::proto::multieko2::adresar::{DeleteAdresarRequest, DeleteAdresarResponse};
|
||||
|
||||
pub async fn delete_adresar(
|
||||
db_pool: &PgPool,
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::adresar::models::Adresar;
|
||||
use crate::proto::multieko2::adresar::{GetAdresarRequest, AdresarResponse};
|
||||
use common::proto::multieko2::adresar::{GetAdresarRequest, AdresarResponse};
|
||||
|
||||
pub async fn get_adresar(
|
||||
db_pool: &PgPool,
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/adresar/handlers/get_adresar_by_position.rs
|
||||
use tonic::{Status};
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::adresar::{AdresarResponse, GetAdresarRequest};
|
||||
use crate::proto::multieko2::common::PositionRequest;
|
||||
use common::proto::multieko2::adresar::{AdresarResponse, GetAdresarRequest};
|
||||
use common::proto::multieko2::common::PositionRequest;
|
||||
use super::get_adresar;
|
||||
|
||||
pub async fn get_adresar_by_position(
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/adresar/handlers/get_adresar_count.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::common::{CountResponse, Empty};
|
||||
use common::proto::multieko2::common::{CountResponse, Empty};
|
||||
|
||||
pub async fn get_adresar_count(
|
||||
db_pool: &PgPool,
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::adresar::models::Adresar;
|
||||
use crate::proto::multieko2::adresar::{PostAdresarRequest, AdresarResponse};
|
||||
use common::proto::multieko2::adresar::{PostAdresarRequest, AdresarResponse};
|
||||
|
||||
pub async fn post_adresar(
|
||||
db_pool: &PgPool,
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::adresar::models::Adresar;
|
||||
use crate::proto::multieko2::adresar::{PutAdresarRequest, AdresarResponse};
|
||||
use common::proto::multieko2::adresar::{PutAdresarRequest, AdresarResponse};
|
||||
|
||||
pub async fn put_adresar(
|
||||
db_pool: &PgPool,
|
||||
@@ -1,8 +1,6 @@
|
||||
// src/lib.rs
|
||||
pub mod db;
|
||||
pub mod client;
|
||||
pub mod server;
|
||||
pub mod proto;
|
||||
pub mod adresar;
|
||||
pub mod uctovnictvo;
|
||||
pub mod shared;
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/main.rs
|
||||
use std::env;
|
||||
use dotenvy::dotenv;
|
||||
use multieko2::{server, client, db};
|
||||
use multieko2::db;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -13,7 +13,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
match env::args().nth(1).as_deref() {
|
||||
Some("server") => server::run_server(db_pool).await?,
|
||||
Some("client") => client::run_ui().await?,
|
||||
_ => println!("Usage: cargo run -- [server|client]"),
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
use tonic::transport::Server;
|
||||
use tonic_reflection::server::Builder as ReflectionBuilder;
|
||||
|
||||
use crate::proto::multieko2::FILE_DESCRIPTOR_SET;
|
||||
use common::proto::multieko2::FILE_DESCRIPTOR_SET;
|
||||
use crate::server::services::{
|
||||
AdresarService,
|
||||
UctovnictvoService,
|
||||
TableStructureHandler
|
||||
};
|
||||
use crate::proto::multieko2::adresar::adresar_server::AdresarServer;
|
||||
use crate::proto::multieko2::uctovnictvo::uctovnictvo_server::UctovnictvoServer;
|
||||
use crate::proto::multieko2::table_structure::table_structure_service_server::TableStructureServiceServer;
|
||||
use common::proto::multieko2::adresar::adresar_server::AdresarServer;
|
||||
use common::proto::multieko2::uctovnictvo::uctovnictvo_server::UctovnictvoServer;
|
||||
use common::proto::multieko2::table_structure::table_structure_service_server::TableStructureServiceServer;
|
||||
|
||||
pub async fn run_server(db_pool: sqlx::PgPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let addr = "[::1]:50051".parse()?;
|
||||
@@ -1,11 +1,11 @@
|
||||
// src/server/services/adresar_service.rs
|
||||
use tonic::{Request, Response, Status};
|
||||
use crate::proto::multieko2::adresar::{
|
||||
use common::proto::multieko2::adresar::{
|
||||
adresar_server::Adresar,
|
||||
PostAdresarRequest, AdresarResponse, GetAdresarRequest, PutAdresarRequest,
|
||||
DeleteAdresarRequest, DeleteAdresarResponse,
|
||||
};
|
||||
use crate::proto::multieko2::common::{Empty, CountResponse, PositionRequest};
|
||||
use common::proto::multieko2::common::{Empty, CountResponse, PositionRequest};
|
||||
use crate::adresar::handlers::{
|
||||
post_adresar, get_adresar, put_adresar, delete_adresar,
|
||||
get_adresar_count, get_adresar_by_position,
|
||||
@@ -1,7 +1,8 @@
|
||||
// src/server/services/table_structure_service.rs
|
||||
use tonic::{Request, Response, Status};
|
||||
use crate::proto::multieko2::table_structure::table_structure_service_server::TableStructureService;
|
||||
use crate::proto::multieko2::table_structure::TableStructureResponse;
|
||||
use common::proto::multieko2::table_structure::table_structure_service_server::TableStructureService;
|
||||
use common::proto::multieko2::table_structure::TableStructureResponse;
|
||||
use common::proto::multieko2::common::Empty;
|
||||
use crate::table_structure::handlers::{
|
||||
get_adresar_table_structure, get_uctovnictvo_table_structure,
|
||||
};
|
||||
@@ -16,7 +17,7 @@ pub struct TableStructureHandler {
|
||||
impl TableStructureService for TableStructureHandler {
|
||||
async fn get_adresar_table_structure(
|
||||
&self,
|
||||
request: Request<crate::proto::multieko2::common::Empty>,
|
||||
request: Request<Empty>,
|
||||
) -> Result<Response<TableStructureResponse>, Status> {
|
||||
let response = get_adresar_table_structure(&self.db_pool, request.into_inner())
|
||||
.await?;
|
||||
@@ -25,7 +26,7 @@ impl TableStructureService for TableStructureHandler {
|
||||
|
||||
async fn get_uctovnictvo_table_structure(
|
||||
&self,
|
||||
request: Request<crate::proto::multieko2::common::Empty>,
|
||||
request: Request<Empty>,
|
||||
) -> Result<Response<TableStructureResponse>, Status> {
|
||||
let response = get_uctovnictvo_table_structure(&self.db_pool, request.into_inner()).await?;
|
||||
Ok(Response::new(response))
|
||||
@@ -1,6 +1,6 @@
|
||||
// src/server/services/uctovnictvo_service.rs
|
||||
use tonic::{Request, Response, Status};
|
||||
use crate::proto::multieko2::uctovnictvo::{
|
||||
use common::proto::multieko2::uctovnictvo::{
|
||||
uctovnictvo_server::Uctovnictvo,
|
||||
PostUctovnictvoRequest, UctovnictvoResponse, GetUctovnictvoRequest, PutUctovnictvoRequest,
|
||||
};
|
||||
@@ -8,7 +8,7 @@ use crate::uctovnictvo::handlers::{
|
||||
post_uctovnictvo, get_uctovnictvo, get_uctovnictvo_count,
|
||||
get_uctovnictvo_by_position, put_uctovnictvo,
|
||||
};
|
||||
use crate::proto::multieko2::common::{Empty, CountResponse, PositionRequest};
|
||||
use common::proto::multieko2::common::{Empty, CountResponse, PositionRequest};
|
||||
use sqlx::PgPool;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/table_structure/handlers/table_structure.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::{
|
||||
use common::proto::multieko2::{
|
||||
table_structure::{TableStructureResponse, TableColumn},
|
||||
common::Empty
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::uctovnictvo::models::Uctovnictvo;
|
||||
use crate::proto::multieko2::uctovnictvo::{GetUctovnictvoRequest, UctovnictvoResponse};
|
||||
use common::proto::multieko2::uctovnictvo::{GetUctovnictvoRequest, UctovnictvoResponse};
|
||||
|
||||
pub async fn get_uctovnictvo(
|
||||
db_pool: &PgPool,
|
||||
@@ -1,13 +1,13 @@
|
||||
// src/uctovnictvo/handlers/get_uctovnictvo_by_position.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::common::PositionRequest;
|
||||
use common::proto::multieko2::common::PositionRequest;
|
||||
use super::get_uctovnictvo;
|
||||
|
||||
pub async fn get_uctovnictvo_by_position(
|
||||
db_pool: &PgPool,
|
||||
request: PositionRequest,
|
||||
) -> Result<crate::proto::multieko2::uctovnictvo::UctovnictvoResponse, Status> {
|
||||
) -> Result<common::proto::multieko2::uctovnictvo::UctovnictvoResponse, Status> {
|
||||
if request.position < 1 {
|
||||
return Err(Status::invalid_argument("Position must be at least 1"));
|
||||
}
|
||||
@@ -30,5 +30,5 @@ pub async fn get_uctovnictvo_by_position(
|
||||
.ok_or_else(|| Status::not_found("Position out of bounds"))?;
|
||||
|
||||
// Now fetch the complete record using the existing get_uctovnictvo function
|
||||
get_uctovnictvo(db_pool, crate::proto::multieko2::uctovnictvo::GetUctovnictvoRequest { id }).await
|
||||
get_uctovnictvo(db_pool, common::proto::multieko2::uctovnictvo::GetUctovnictvoRequest { id }).await
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/uctovnictvo/handlers/get_uctovnictvo_count.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::common::{CountResponse, Empty};
|
||||
use common::proto::multieko2::common::{CountResponse, Empty};
|
||||
|
||||
pub async fn get_uctovnictvo_count(
|
||||
db_pool: &PgPool,
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::uctovnictvo::models::Uctovnictvo;
|
||||
use crate::proto::multieko2::uctovnictvo::{PostUctovnictvoRequest, UctovnictvoResponse};
|
||||
use common::proto::multieko2::uctovnictvo::{PostUctovnictvoRequest, UctovnictvoResponse};
|
||||
use crate::shared::date_utils::parse_date_with_multiple_formats; // Import from shared module
|
||||
|
||||
pub async fn post_uctovnictvo(
|
||||
@@ -2,7 +2,7 @@
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::uctovnictvo::models::Uctovnictvo;
|
||||
use crate::proto::multieko2::uctovnictvo::{PutUctovnictvoRequest, UctovnictvoResponse};
|
||||
use common::proto::multieko2::uctovnictvo::{PutUctovnictvoRequest, UctovnictvoResponse};
|
||||
use crate::shared::date_utils::parse_date_with_multiple_formats; // Import from shared module
|
||||
|
||||
pub async fn put_uctovnictvo(
|
||||
@@ -1,22 +0,0 @@
|
||||
// src/proto/mod.rs
|
||||
pub mod multieko2 {
|
||||
tonic::include_proto!("multieko2");
|
||||
|
||||
pub mod adresar {
|
||||
tonic::include_proto!("multieko2.adresar");
|
||||
}
|
||||
|
||||
pub mod uctovnictvo {
|
||||
tonic::include_proto!("multieko2.uctovnictvo");
|
||||
}
|
||||
|
||||
pub mod common {
|
||||
tonic::include_proto!("multieko2.common");
|
||||
}
|
||||
|
||||
pub mod table_structure {
|
||||
tonic::include_proto!("multieko2.table_structure");
|
||||
}
|
||||
|
||||
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("descriptor.bin");
|
||||
}
|
||||