docs for table structure

This commit is contained in:
filipriec
2025-02-22 17:05:58 +01:00
parent 13d9377086
commit 73ac6d16d3
3 changed files with 151 additions and 71 deletions

View File

@@ -1,12 +1,11 @@
grpcurl -plaintext localhost:50051 multieko2.Adresar/GetTableStructure
Adresar response:
grpcurl -plaintext \
-proto proto/table_structure.proto \
-import-path proto \
localhost:50051 \
multieko2.table_structure.TableStructureService/GetAdresarTableStructure
{
"columns": [
{
"name": "id",
"dataType": "BIGSERIAL",
"isPrimaryKey": true
},
{
"name": "firma",
"dataType": "TEXT"
@@ -80,10 +79,6 @@
"name": "fax",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "created_at",
"dataType": "TIMESTAMPTZ"
}
]
}

View File

@@ -1,4 +1,4 @@
// src/table_structure/handlers.rs
// src/table_structure/handlers/table_structure.rs
use tonic::Status;
use sqlx::PgPool;
use crate::proto::multieko2::{
@@ -17,7 +17,90 @@ pub async fn get_adresar_table_structure(
is_nullable: false,
is_primary_key: false,
},
// ... other columns from original adresar handler
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 })
}
@@ -33,7 +116,66 @@ pub async fn get_uctovnictvo_table_structure(
is_nullable: false,
is_primary_key: false,
},
// ... other columns from original uctovnictvo handler
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 })
}

View File

@@ -39,60 +39,3 @@
"firma": "AAA"
}
grpcurl -plaintext -d '{}' localhost:50051 multieko2.uctovnictvo.Uctovnictvo/GetTableStructure
{
"columns": [
{
"name": "adresar_id",
"dataType": "BIGINT"
},
{
"name": "c_dokladu",
"dataType": "TEXT"
},
{
"name": "datum",
"dataType": "DATE"
},
{
"name": "c_faktury",
"dataType": "TEXT"
},
{
"name": "obsah",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "stredisko",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "c_uctu",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "md",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "identif",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "poznanka",
"dataType": "TEXT",
"isNullable": true
},
{
"name": "firma",
"dataType": "TEXT"
}
]
}