docs + adjusted format imported
This commit is contained in:
27
src/uctovnictvo/docs/example.txt
Normal file
27
src/uctovnictvo/docs/example.txt
Normal 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"
|
||||||
|
}
|
||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user