post method into user created tables is working perfectly well
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
// src/server/services/tables_data_service.rs
|
// src/server/services/tables_data_service.rs
|
||||||
use tonic::{Request, Response, Status};
|
use tonic::{Request, Response, Status};
|
||||||
use common::proto::multieko2::tables_data::{TablesData, PostTableDataRequest, PostTableDataResponse};
|
use common::proto::multieko2::tables_data::tables_data_server::TablesData;
|
||||||
|
use common::proto::multieko2::tables_data::{PostTableDataRequest, PostTableDataResponse};
|
||||||
use crate::tables_data::handlers::post_table_data;
|
use crate::tables_data::handlers::post_table_data;
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ impl TablesData for TablesDataService {
|
|||||||
request: Request<PostTableDataRequest>,
|
request: Request<PostTableDataRequest>,
|
||||||
) -> Result<Response<PostTableDataResponse>, Status> {
|
) -> Result<Response<PostTableDataResponse>, Status> {
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
let response = post_table_data(&self.db_pool, request).await?;
|
// Just pass through the response instead of creating a new one
|
||||||
Ok(Response::new(response))
|
post_table_data(&self.db_pool, request).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
60
server/src/tables_data/docs/post_data
Normal file
60
server/src/tables_data/docs/post_data
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
❯ grpcurl -plaintext -d '{}' localhost:50051 multieko2.table_definition.TableDefinition/GetProfileTree
|
||||||
|
{
|
||||||
|
"profiles": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"tables": [
|
||||||
|
{
|
||||||
|
"name": "2025_company_data1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
❯ grpcurl -plaintext -d '{
|
||||||
|
"profile_name": "default",
|
||||||
|
"table_name": "2025_company_data1",
|
||||||
|
"data": {
|
||||||
|
"firma": "ACME Corporation",
|
||||||
|
"company_name": "ACME Corp",
|
||||||
|
"textfield": "This is sample text",
|
||||||
|
"textfield2": "Additional information",
|
||||||
|
"textfield3": "More details",
|
||||||
|
"headquarters_psc": "12345",
|
||||||
|
"contact_phone": "123-456-7890",
|
||||||
|
"office_address": "123 Main St, Springfield",
|
||||||
|
"support_email": "support@acmecorp.com",
|
||||||
|
"is_active": "true"
|
||||||
|
}
|
||||||
|
}' localhost:50051 multieko2.tables_data.TablesData/PostTableData
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "Data inserted successfully",
|
||||||
|
"insertedId": "1"
|
||||||
|
}
|
||||||
|
❯ psql -U multi_psql_dev -d multi_rust_dev
|
||||||
|
psql (17.2)
|
||||||
|
Type "help" for help.
|
||||||
|
|
||||||
|
multi_rust_dev=> \dt
|
||||||
|
List of relations
|
||||||
|
Schema | Name | Type | Owner
|
||||||
|
--------+--------------------+-------+----------------
|
||||||
|
public | 2025_company_data1 | table | multi_psql_dev
|
||||||
|
public | _sqlx_migrations | table | multi_psql_dev
|
||||||
|
public | adresar | table | multi_psql_dev
|
||||||
|
public | profiles | table | multi_psql_dev
|
||||||
|
public | table_definitions | table | multi_psql_dev
|
||||||
|
public | uctovnictvo | table | multi_psql_dev
|
||||||
|
(6 rows)
|
||||||
|
|
||||||
|
multi_rust_dev=> SELECT * FROM "2025_company_data1";
|
||||||
|
|
||||||
|
id | deleted | firma | company_name | textfield | textfield2 | textfield3 | headquarters_psc | contact_phone | office_address | support_email | is_active | last_updated | created_at
|
||||||
|
----+---------+------------------+--------------+---------------------+------------------------+--------------+------------------+---------------+--------------------------+----------------------+-----------+--------------+-------------------------------
|
||||||
|
1 | f | ACME Corporation | ACME Corp | This is sample text | Additional information | More details | 12345 | 123-456-7890 | 123 Main St, Springfield | support@acmecorp.com | t | | 2025-03-03 16:25:29.464753+01
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
~
|
||||||
|
~
|
||||||
|
~
|
||||||
Reference in New Issue
Block a user