36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
// src/server/services/table_structure_service.rs
|
|
use tonic::{Request, Response, Status};
|
|
use crate::proto::multieko2::table_structure::table_structure_service_server::{
|
|
TableStructureService, TableStructureServiceServer,
|
|
};
|
|
use crate::proto::multieko2::table_structure::TableStructureResponse;
|
|
use crate::table_structure::handlers::{
|
|
get_adresar_table_structure, get_uctovnictvo_table_structure,
|
|
};
|
|
use sqlx::PgPool;
|
|
|
|
#[derive(Debug)]
|
|
pub struct TableStructureHandler {
|
|
pub db_pool: PgPool,
|
|
}
|
|
|
|
#[tonic::async_trait]
|
|
impl TableStructureService for TableStructureHandler {
|
|
async fn get_adresar_table_structure(
|
|
&self,
|
|
request: Request<crate::proto::multieko2::common::Empty>,
|
|
) -> Result<Response<TableStructureResponse>, Status> {
|
|
let response = 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> {
|
|
let response = get_uctovnictvo_table_structure(&self.db_pool, request.into_inner()).await?;
|
|
Ok(Response::new(response))
|
|
}
|
|
}
|