uctovnictvo table structure
This commit is contained in:
@@ -11,6 +11,7 @@ service Uctovnictvo {
|
||||
rpc GetUctovnictvoCount (multieko2.adresar.Empty) returns (multieko2.adresar.CountResponse);
|
||||
rpc GetUctovnictvoByPosition (multieko2.adresar.PositionRequest) returns (UctovnictvoResponse);
|
||||
rpc PutUctovnictvo (PutUctovnictvoRequest) returns (UctovnictvoResponse);
|
||||
rpc GetTableStructure (multieko2.adresar.Empty) returns (multieko2.adresar.TableStructureResponse);
|
||||
}
|
||||
|
||||
message PostUctovnictvoRequest {
|
||||
|
||||
Binary file not shown.
@@ -4,7 +4,10 @@ use tonic_reflection::server::Builder as ReflectionBuilder;
|
||||
use crate::adresar::handlers::{
|
||||
post_adresar, get_adresar, put_adresar, delete_adresar, get_adresar_count, get_adresar_by_position, get_table_structure
|
||||
};
|
||||
use crate::uctovnictvo::handlers::{post_uctovnictvo, get_uctovnictvo, get_uctovnictvo_count, get_uctovnictvo_by_position, put_uctovnictvo,};
|
||||
use crate::uctovnictvo::handlers::{
|
||||
post_uctovnictvo, get_uctovnictvo, get_uctovnictvo_count, get_uctovnictvo_by_position,
|
||||
put_uctovnictvo, get_table_structure as get_uctovnictvo_table_structure,
|
||||
};
|
||||
use crate::proto::multieko2::{
|
||||
FILE_DESCRIPTOR_SET,
|
||||
};
|
||||
@@ -128,6 +131,14 @@ impl Uctovnictvo for UctovnictvoService {
|
||||
let response = put_uctovnictvo(&self.db_pool, request.into_inner()).await?;
|
||||
Ok(Response::new(response))
|
||||
}
|
||||
|
||||
async fn get_table_structure(
|
||||
&self,
|
||||
request: Request<Empty>,
|
||||
) -> Result<Response<TableStructureResponse>, Status> {
|
||||
let response = get_uctovnictvo_table_structure(&self.db_pool, request.into_inner()).await?;
|
||||
Ok(Response::new(response))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run_server(db_pool: sqlx::PgPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
@@ -4,9 +4,11 @@ pub mod get_uctovnictvo;
|
||||
pub mod get_uctovnictvo_count;
|
||||
pub mod get_uctovnictvo_by_position;
|
||||
pub mod put_uctovnictvo;
|
||||
pub mod get_table_structure;
|
||||
|
||||
pub use post_uctovnictvo::post_uctovnictvo;
|
||||
pub use get_uctovnictvo::get_uctovnictvo;
|
||||
pub use get_uctovnictvo_count::get_uctovnictvo_count;
|
||||
pub use get_uctovnictvo_by_position::get_uctovnictvo_by_position;
|
||||
pub use put_uctovnictvo::put_uctovnictvo;
|
||||
pub use get_table_structure::get_table_structure;
|
||||
|
||||
80
src/uctovnictvo/handlers/get_table_structure.rs
Normal file
80
src/uctovnictvo/handlers/get_table_structure.rs
Normal file
@@ -0,0 +1,80 @@
|
||||
// src/uctovnictvo/handlers/get_table_structure.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::adresar::{TableStructureResponse, TableColumn, Empty};
|
||||
|
||||
pub async fn get_table_structure(
|
||||
db_pool: &PgPool,
|
||||
_request: Empty,
|
||||
) -> Result<TableStructureResponse, Status> {
|
||||
let columns = vec![
|
||||
TableColumn {
|
||||
name: "adresar_id".to_string(),
|
||||
data_type: "BIGINT".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "c_dokladu".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "datum".to_string(),
|
||||
data_type: "DATE".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "c_faktury".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "obsah".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "stredisko".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "c_uctu".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "md".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "identif".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "poznanka".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "firma".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
];
|
||||
|
||||
Ok(TableStructureResponse { columns })
|
||||
}
|
||||
Reference in New Issue
Block a user