docs + adjusted format imported

This commit is contained in:
filipriec
2025-02-21 21:27:14 +01:00
parent d37edb63f7
commit b4971b2989
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
grpcurl -plaintext -d '{
"adresar_id": 1,
"c_dokladu": "DOC123",
"datum": "01:10:2023",
"c_faktury": "INV123",
"obsah": "Sample content",
"stredisko": "Center A",
"c_uctu": "ACC123",
"md": "MD123",
"identif": "ID123",
"poznanka": "Sample note",
"firma": "AAA"
}' localhost:50051 multieko2.uctovnictvo.Uctovnictvo/PostUctovnictvo
{
"id": "3",
"adresarId": "1",
"cDokladu": "DOC123",
"datum": "2023-10-01",
"cFaktury": "INV123",
"obsah": "Sample content",
"stredisko": "Center A",
"cUctu": "ACC123",
"md": "MD123",
"identif": "ID123",
"poznanka": "Sample note",
"firma": "AAA"
}

View File

@@ -10,7 +10,7 @@ pub async fn post_uctovnictvo(
request: PostUctovnictvoRequest, request: PostUctovnictvoRequest,
) -> Result<UctovnictvoResponse, Status> { ) -> Result<UctovnictvoResponse, Status> {
// Parse the date string into a chrono::NaiveDate. // Parse the date string into a chrono::NaiveDate.
let datum = NaiveDate::parse_from_str(&request.datum, "%Y-%m-%d") let datum = NaiveDate::parse_from_str(&request.datum, "%d:%m:%Y")
.map_err(|e| Status::invalid_argument(format!("Invalid date: {}", e)))?; .map_err(|e| Status::invalid_argument(format!("Invalid date: {}", e)))?;
// Pass the NaiveDate value directly. // Pass the NaiveDate value directly.