fixing errors, slowly moving forwards
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,9 @@
|
||||
// src/proto/mod.rs
|
||||
pub mod multieko2 {
|
||||
tonic::include_proto!("multieko2");
|
||||
pub mod uctovnictvo {
|
||||
tonic::include_proto!("multieko2.uctovnictvo");
|
||||
}
|
||||
|
||||
// Include the file descriptor set
|
||||
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("descriptor.bin");
|
||||
|
||||
@@ -8,11 +8,14 @@ use crate::uctovnictvo::handlers::post_uctovnictvo;
|
||||
use crate::proto::multieko2::{
|
||||
PostAdresarRequest, AdresarResponse, GetAdresarRequest, PutAdresarRequest,
|
||||
DeleteAdresarRequest, DeleteAdresarResponse, PositionRequest, CountResponse, Empty,
|
||||
TableStructureResponse,
|
||||
TableStructureResponse, PostUctovnictvoRequest, UctovnictvoResponse,
|
||||
adresar_server::{Adresar, AdresarServer},
|
||||
uctovnictvo_server::{Uctovnictvo, UctovnictvoServer},
|
||||
FILE_DESCRIPTOR_SET,
|
||||
};
|
||||
use crate::proto::multieko2::uctovnictvo::{
|
||||
uctovnictvo_server::{Uctovnictvo, UctovnictvoServer},
|
||||
PostUctovnictvoRequest, UctovnictvoResponse
|
||||
};
|
||||
|
||||
pub struct AdresarService {
|
||||
db_pool: sqlx::PgPool,
|
||||
|
||||
@@ -3,15 +3,15 @@ use tonic::Status;
|
||||
use sqlx::PgPool;
|
||||
use chrono::NaiveDate;
|
||||
use crate::uctovnictvo::models::Uctovnictvo;
|
||||
use crate::proto::multieko2::{PostUctovnictvoRequest, UctovnictvoResponse};
|
||||
use crate::proto::multieko2::uctovnictvo::{PostUctovnictvoRequest, UctovnictvoResponse};
|
||||
|
||||
pub async fn post_uctovnictvo(
|
||||
db_pool: &PgPool,
|
||||
request: PostUctovnictvoRequest,
|
||||
) -> Result<UctovnictvoResponse, Status> {
|
||||
// Parse the date string into NaiveDate
|
||||
let datum = NaiveDate::parse_from_str(&request.datum, "%Y-%m-%d")
|
||||
.map_err(|e| Status::invalid_argument(format!("Invalid date format: {}", e)))?;
|
||||
let datum = chrono::NaiveDate::parse_from_str(&request.datum, "%Y-%m-%d")
|
||||
.map_err(|e| Status::invalid_argument(format!("Invalid date: {}", e)))?;
|
||||
|
||||
let uctovnictvo = sqlx::query_as!(
|
||||
Uctovnictvo,
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
use chrono::NaiveDate;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, sqlx::FromRow, Serialize, Deserialize)]
|
||||
pub struct Uctovnictvo {
|
||||
pub id: i64,
|
||||
pub deleted: bool,
|
||||
pub adresar_id: i64,
|
||||
pub c_dokladu: String,
|
||||
pub datum: NaiveDate, // Use chrono::NaiveDate for better date handling
|
||||
pub datum: chrono::NaiveDate,
|
||||
pub c_faktury: String,
|
||||
pub obsah: Option<String>,
|
||||
pub stredisko: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user