complete redesign
This commit is contained in:
13
common/Cargo.toml
Normal file
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"
|
||||
17
common/build.rs
Normal file
17
common/build.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
// build.rs
|
||||
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(
|
||||
&[
|
||||
"proto/common.proto",
|
||||
"proto/adresar.proto",
|
||||
"proto/uctovnictvo.proto",
|
||||
"proto/table_structure.proto"
|
||||
],
|
||||
&["proto"],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
83
common/proto/adresar.proto
Normal file
83
common/proto/adresar.proto
Normal file
@@ -0,0 +1,83 @@
|
||||
// proto/adresar.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.adresar;
|
||||
|
||||
import "common.proto";
|
||||
import "table_structure.proto";
|
||||
|
||||
service Adresar {
|
||||
rpc PostAdresar (PostAdresarRequest) returns (AdresarResponse);
|
||||
rpc GetAdresar (GetAdresarRequest) returns (AdresarResponse);
|
||||
rpc PutAdresar (PutAdresarRequest) returns (AdresarResponse);
|
||||
rpc DeleteAdresar (DeleteAdresarRequest) returns (DeleteAdresarResponse);
|
||||
rpc GetAdresarCount (common.Empty) returns (common.CountResponse);
|
||||
rpc GetAdresarByPosition (common.PositionRequest) returns (AdresarResponse);
|
||||
}
|
||||
|
||||
message GetAdresarRequest {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DeleteAdresarRequest {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message PostAdresarRequest {
|
||||
string firma = 1;
|
||||
string kz = 2;
|
||||
string drc = 3;
|
||||
string ulica = 4;
|
||||
string psc = 5;
|
||||
string mesto = 6;
|
||||
string stat = 7;
|
||||
string banka = 8;
|
||||
string ucet = 9;
|
||||
string skladm = 10;
|
||||
string ico = 11;
|
||||
string kontakt = 12;
|
||||
string telefon = 13;
|
||||
string skladu = 14;
|
||||
string fax = 15;
|
||||
}
|
||||
|
||||
message AdresarResponse {
|
||||
int64 id = 1;
|
||||
string firma = 2;
|
||||
string kz = 3;
|
||||
string drc = 4;
|
||||
string ulica = 5;
|
||||
string psc = 6;
|
||||
string mesto = 7;
|
||||
string stat = 8;
|
||||
string banka = 9;
|
||||
string ucet = 10;
|
||||
string skladm = 11;
|
||||
string ico = 12;
|
||||
string kontakt = 13;
|
||||
string telefon = 14;
|
||||
string skladu = 15;
|
||||
string fax = 16;
|
||||
}
|
||||
|
||||
message PutAdresarRequest {
|
||||
int64 id = 1;
|
||||
string firma = 2;
|
||||
string kz = 3;
|
||||
string drc = 4;
|
||||
string ulica = 5;
|
||||
string psc = 6;
|
||||
string mesto = 7;
|
||||
string stat = 8;
|
||||
string banka = 9;
|
||||
string ucet = 10;
|
||||
string skladm = 11;
|
||||
string ico = 12;
|
||||
string kontakt = 13;
|
||||
string telefon = 14;
|
||||
string skladu = 15;
|
||||
string fax = 16;
|
||||
}
|
||||
|
||||
message DeleteAdresarResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
7
common/proto/common.proto
Normal file
7
common/proto/common.proto
Normal file
@@ -0,0 +1,7 @@
|
||||
// proto/common.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.common;
|
||||
|
||||
message Empty {}
|
||||
message CountResponse { int64 count = 1; }
|
||||
message PositionRequest { int64 position = 1; }
|
||||
21
common/proto/table_structure.proto
Normal file
21
common/proto/table_structure.proto
Normal file
@@ -0,0 +1,21 @@
|
||||
// proto/table_structure.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.table_structure;
|
||||
|
||||
import "common.proto";
|
||||
|
||||
message TableStructureResponse {
|
||||
repeated TableColumn columns = 1;
|
||||
}
|
||||
|
||||
message TableColumn {
|
||||
string name = 1;
|
||||
string data_type = 2;
|
||||
bool is_nullable = 3;
|
||||
bool is_primary_key = 4;
|
||||
}
|
||||
|
||||
service TableStructureService {
|
||||
rpc GetAdresarTableStructure (common.Empty) returns (TableStructureResponse);
|
||||
rpc GetUctovnictvoTableStructure (common.Empty) returns (TableStructureResponse);
|
||||
}
|
||||
61
common/proto/uctovnictvo.proto
Normal file
61
common/proto/uctovnictvo.proto
Normal file
@@ -0,0 +1,61 @@
|
||||
// proto/uctovnictvo.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.uctovnictvo;
|
||||
|
||||
import "common.proto";
|
||||
|
||||
service Uctovnictvo {
|
||||
rpc PostUctovnictvo (PostUctovnictvoRequest) returns (UctovnictvoResponse);
|
||||
rpc GetUctovnictvo (GetUctovnictvoRequest) returns (UctovnictvoResponse);
|
||||
rpc GetUctovnictvoCount (common.Empty) returns (common.CountResponse);
|
||||
rpc GetUctovnictvoByPosition (common.PositionRequest) returns (UctovnictvoResponse);
|
||||
rpc PutUctovnictvo (PutUctovnictvoRequest) returns (UctovnictvoResponse);
|
||||
}
|
||||
|
||||
message PostUctovnictvoRequest {
|
||||
int64 adresar_id = 1;
|
||||
string c_dokladu = 2;
|
||||
string datum = 3; // Use string for simplicity, or use google.protobuf.Timestamp for better date handling
|
||||
string c_faktury = 4;
|
||||
string obsah = 5;
|
||||
string stredisko = 6;
|
||||
string c_uctu = 7;
|
||||
string md = 8;
|
||||
string identif = 9;
|
||||
string poznanka = 10;
|
||||
string firma = 11;
|
||||
}
|
||||
|
||||
message UctovnictvoResponse {
|
||||
int64 id = 1;
|
||||
int64 adresar_id = 2;
|
||||
string c_dokladu = 3;
|
||||
string datum = 4;
|
||||
string c_faktury = 5;
|
||||
string obsah = 6;
|
||||
string stredisko = 7;
|
||||
string c_uctu = 8;
|
||||
string md = 9;
|
||||
string identif = 10;
|
||||
string poznanka = 11;
|
||||
string firma = 12;
|
||||
}
|
||||
|
||||
message PutUctovnictvoRequest {
|
||||
int64 id = 1;
|
||||
int64 adresar_id = 2;
|
||||
string c_dokladu = 3;
|
||||
string datum = 4;
|
||||
string c_faktury = 5;
|
||||
string obsah = 6;
|
||||
string stredisko = 7;
|
||||
string c_uctu = 8;
|
||||
string md = 9;
|
||||
string identif = 10;
|
||||
string poznanka = 11;
|
||||
string firma = 12;
|
||||
}
|
||||
|
||||
message GetUctovnictvoRequest {
|
||||
int64 id = 1;
|
||||
}
|
||||
7
common/src/lib.rs
Normal file
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");
|
||||
}
|
||||
Reference in New Issue
Block a user