improving get method and its test
This commit is contained in:
@@ -30,13 +30,16 @@ pub async fn get_adresar(
|
||||
skladu,
|
||||
fax
|
||||
FROM adresar
|
||||
WHERE id = $1
|
||||
WHERE id = $1 AND deleted = false
|
||||
"#,
|
||||
request.id
|
||||
)
|
||||
.fetch_one(db_pool)
|
||||
.await
|
||||
.map_err(|e| Status::not_found(e.to_string()))?;
|
||||
.map_err(|e| match e {
|
||||
sqlx::Error::RowNotFound => Status::not_found("Record not found"),
|
||||
_ => Status::internal(format!("Database error: {}", e)),
|
||||
})?;
|
||||
|
||||
Ok(AdresarResponse {
|
||||
id: adresar.id,
|
||||
|
||||
Reference in New Issue
Block a user