diff --git a/src/uctovnictvo/docs/example.txt b/src/uctovnictvo/docs/example.txt new file mode 100644 index 0000000..6bce029 --- /dev/null +++ b/src/uctovnictvo/docs/example.txt @@ -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" +} diff --git a/src/uctovnictvo/handlers/post_uctovnictvo.rs b/src/uctovnictvo/handlers/post_uctovnictvo.rs index 2ede2c9..872ff47 100644 --- a/src/uctovnictvo/handlers/post_uctovnictvo.rs +++ b/src/uctovnictvo/handlers/post_uctovnictvo.rs @@ -10,7 +10,7 @@ pub async fn post_uctovnictvo( request: PostUctovnictvoRequest, ) -> Result { // 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)))?; // Pass the NaiveDate value directly.