complete redesign
This commit is contained in:
84
server/src/table_structure/docs/response.txt
Normal file
84
server/src/table_structure/docs/response.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
Adresar response:
|
||||
❯ grpcurl -plaintext \
|
||||
-proto proto/table_structure.proto \
|
||||
-import-path proto \
|
||||
localhost:50051 \
|
||||
multieko2.table_structure.TableStructureService/GetAdresarTableStructure
|
||||
{
|
||||
"columns": [
|
||||
{
|
||||
"name": "firma",
|
||||
"dataType": "TEXT"
|
||||
},
|
||||
{
|
||||
"name": "kz",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "drc",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "ulica",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "psc",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "mesto",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "stat",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "banka",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "ucet",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "skladm",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "ico",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "kontakt",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "telefon",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "skladu",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
},
|
||||
{
|
||||
"name": "fax",
|
||||
"dataType": "TEXT",
|
||||
"isNullable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
4
server/src/table_structure/handlers.rs
Normal file
4
server/src/table_structure/handlers.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
// src/table_structure/handlers.rs
|
||||
pub mod table_structure;
|
||||
|
||||
pub use table_structure::{get_adresar_table_structure, get_uctovnictvo_table_structure};
|
||||
181
server/src/table_structure/handlers/table_structure.rs
Normal file
181
server/src/table_structure/handlers/table_structure.rs
Normal file
@@ -0,0 +1,181 @@
|
||||
// src/table_structure/handlers/table_structure.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use common::proto::multieko2::{
|
||||
table_structure::{TableStructureResponse, TableColumn},
|
||||
common::Empty
|
||||
};
|
||||
|
||||
pub async fn get_adresar_table_structure(
|
||||
_db_pool: &PgPool,
|
||||
_request: Empty,
|
||||
) -> Result<TableStructureResponse, Status> {
|
||||
let columns = vec![
|
||||
TableColumn {
|
||||
name: "firma".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: false,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "kz".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "drc".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "ulica".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "psc".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "mesto".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "stat".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "banka".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "ucet".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "skladm".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "ico".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "kontakt".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "telefon".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "skladu".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
TableColumn {
|
||||
name: "fax".to_string(),
|
||||
data_type: "TEXT".to_string(),
|
||||
is_nullable: true,
|
||||
is_primary_key: false,
|
||||
},
|
||||
];
|
||||
Ok(TableStructureResponse { columns })
|
||||
}
|
||||
|
||||
pub async fn get_uctovnictvo_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 })
|
||||
}
|
||||
3
server/src/table_structure/mod.rs
Normal file
3
server/src/table_structure/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
// src/table_structure/mod.rs
|
||||
|
||||
pub mod handlers;
|
||||
Reference in New Issue
Block a user