feat: vertical slice — migrations, postgres adapters, presentation handlers, bootstrap wiring
This commit is contained in:
@@ -40,43 +40,43 @@ pub async fn ingest(
|
||||
match name.as_str() {
|
||||
"file" => {
|
||||
filename = field.file_name().map(|s| s.to_string());
|
||||
let data = field
|
||||
.bytes()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Internal(e.to_string()))
|
||||
})?;
|
||||
let data = field.bytes().await.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Internal(e.to_string()))
|
||||
})?;
|
||||
file_data = Some(data);
|
||||
}
|
||||
"target_path_id" => {
|
||||
let text = field
|
||||
.text()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Validation(e.to_string()))
|
||||
})?;
|
||||
let text = field.text().await.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Validation(e.to_string()))
|
||||
})?;
|
||||
target_path_id = Some(text.parse::<uuid::Uuid>().map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Validation(e.to_string()))
|
||||
})?);
|
||||
}
|
||||
"client_device_id" => {
|
||||
client_device_id = field
|
||||
.text()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Validation(e.to_string()))
|
||||
})?;
|
||||
client_device_id = field.text().await.map_err(|e| {
|
||||
AppError::from(domain::errors::DomainError::Validation(e.to_string()))
|
||||
})?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let data = file_data
|
||||
.ok_or_else(|| AppError::from(domain::errors::DomainError::Validation("Missing file field".to_string())))?;
|
||||
let fname = filename
|
||||
.ok_or_else(|| AppError::from(domain::errors::DomainError::Validation("Missing filename".to_string())))?;
|
||||
let path_id = target_path_id
|
||||
.ok_or_else(|| AppError::from(domain::errors::DomainError::Validation("Missing target_path_id".to_string())))?;
|
||||
let data = file_data.ok_or_else(|| {
|
||||
AppError::from(domain::errors::DomainError::Validation(
|
||||
"Missing file field".to_string(),
|
||||
))
|
||||
})?;
|
||||
let fname = filename.ok_or_else(|| {
|
||||
AppError::from(domain::errors::DomainError::Validation(
|
||||
"Missing filename".to_string(),
|
||||
))
|
||||
})?;
|
||||
let path_id = target_path_id.ok_or_else(|| {
|
||||
AppError::from(domain::errors::DomainError::Validation(
|
||||
"Missing target_path_id".to_string(),
|
||||
))
|
||||
})?;
|
||||
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&data);
|
||||
|
||||
Reference in New Issue
Block a user