more changes to the structure of the project
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// proto/common.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.common;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// proto/table_structure.proto
|
||||
syntax = "proto3";
|
||||
package multieko2.table_structure;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ pub mod put_adresar;
|
||||
pub mod delete_adresar;
|
||||
pub mod get_adresar_count;
|
||||
pub mod get_adresar_by_position;
|
||||
pub mod get_table_structure;
|
||||
|
||||
pub use post_adresar::post_adresar;
|
||||
pub use get_adresar::get_adresar;
|
||||
@@ -14,4 +13,3 @@ pub use put_adresar::put_adresar;
|
||||
pub use delete_adresar::delete_adresar;
|
||||
pub use get_adresar_count::get_adresar_count;
|
||||
pub use get_adresar_by_position::get_adresar_by_position;
|
||||
pub use get_table_structure::get_table_structure;
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
// src/adresar/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: "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 })
|
||||
}
|
||||
Binary file not shown.
@@ -23,15 +23,6 @@ use crate::proto::multieko2::uctovnictvo::{
|
||||
uctovnictvo_server::{Uctovnictvo, UctovnictvoServer},
|
||||
PostUctovnictvoRequest, UctovnictvoResponse, GetUctovnictvoRequest, PutUctovnictvoRequest,
|
||||
};
|
||||
use crate::proto::multieko2::table_structure::{
|
||||
table_structure_service_server::{TableStructureService, TableStructureServiceServer},
|
||||
TableStructureResponse
|
||||
};
|
||||
use crate::proto::multieko2::{
|
||||
common::{Empty, CountResponse, PositionRequest},
|
||||
table_structure::{TableStructureResponse, TableColumn}
|
||||
};
|
||||
|
||||
pub struct AdresarService {
|
||||
db_pool: sqlx::PgPool,
|
||||
}
|
||||
@@ -123,7 +114,7 @@ impl Uctovnictvo for UctovnictvoService {
|
||||
|
||||
async fn get_uctovnictvo_by_position(
|
||||
&self,
|
||||
request: Request<crate::proto::multieko2::adresar::PositionRequest>,
|
||||
request: Request<PositionRequest>,
|
||||
) -> Result<Response<UctovnictvoResponse>, Status> {
|
||||
let response = get_uctovnictvo_by_position(&self.db_pool, request.into_inner()).await?;
|
||||
Ok(Response::new(response))
|
||||
@@ -144,14 +135,18 @@ impl TableStructureService for TableStructureHandler {
|
||||
&self,
|
||||
request: Request<crate::proto::multieko2::common::Empty>,
|
||||
) -> Result<Response<TableStructureResponse>, Status> {
|
||||
handlers::get_adresar_table_structure(&self.db_pool, request.into_inner()).await
|
||||
let response = handlers::get_adresar_table_structure(&self.db_pool, request.into_inner())
|
||||
.await?;
|
||||
Ok(Response::new(response))
|
||||
}
|
||||
|
||||
async fn get_uctovnictvo_table_structure(
|
||||
&self,
|
||||
request: Request<crate::proto::multieko2::common::Empty>,
|
||||
) -> Result<Response<TableStructureResponse>, Status> {
|
||||
handlers::get_uctovnictvo_table_structure(&self.db_pool, request.into_inner()).await
|
||||
let response =
|
||||
handlers::get_uctovnictvo_table_structure(&self.db_pool, request.into_inner()).await?;
|
||||
Ok(Response::new(response))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,9 @@ 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;
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
// 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 })
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/uctovnictvo/handlers/get_uctovnictvo_by_position.rs
|
||||
use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use crate::proto::multieko2::adresar::PositionRequest;
|
||||
use crate::proto::multieko2::common::PositionRequest;
|
||||
use super::get_uctovnictvo;
|
||||
|
||||
pub async fn get_uctovnictvo_by_position(
|
||||
|
||||
Reference in New Issue
Block a user