refactor(services): add file_lifecycle and blob_lifecycle
- complete src/application/ports/blob_lifecycle.rs with traits:
* BlobCreationHook
* BlobDeletionHook
- add src/application/ports/file_lifecycle.rs with traits:
* FileCreatedHook
* FileDeletedHook
* FileUpdatedHook
This commit is contained in:
@@ -972,15 +972,6 @@ async fn handle_put(
|
||||
);
|
||||
}
|
||||
|
||||
state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(
|
||||
file_dto.id.clone(),
|
||||
file_dto.etag.clone(),
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
Ok(Response::builder()
|
||||
.status(StatusCode::NO_CONTENT)
|
||||
.body(Body::empty())
|
||||
|
||||
@@ -288,19 +288,7 @@ async fn put_file(
|
||||
let _ = tokio::fs::remove_file(&temp_path).await;
|
||||
|
||||
match result {
|
||||
Ok(file_dto) => {
|
||||
state
|
||||
.app_state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(
|
||||
file_dto.id.clone(),
|
||||
file_dto.etag.clone(),
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
StatusCode::OK.into_response()
|
||||
}
|
||||
Ok(_file_dto) => StatusCode::OK.into_response(),
|
||||
Err(e) => {
|
||||
tracing::error!("WOPI PutFile failed: {}", e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR.into_response()
|
||||
|
||||
@@ -164,11 +164,6 @@ async fn handle_assemble(
|
||||
.await
|
||||
.map_err(|e| AppError::internal_error(format!("Failed to update file: {}", e)))?;
|
||||
|
||||
state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(dto.id.clone(), dto.etag.clone(), &content_type)
|
||||
.await;
|
||||
|
||||
Some(dto.etag)
|
||||
} else {
|
||||
// For new files we still need to read the temp file since create_file takes &[u8].
|
||||
|
||||
@@ -566,16 +566,6 @@ async fn handle_put(
|
||||
}
|
||||
}
|
||||
|
||||
// Bug 1 & 2 fix: invalidate stale thumbnail and regenerate from new blob.
|
||||
state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(
|
||||
updated.id.clone(),
|
||||
updated.etag.clone(),
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
return Ok(Response::builder()
|
||||
.status(StatusCode::NO_CONTENT)
|
||||
.header(header::ETAG, format!("\"{}\"", updated.etag))
|
||||
|
||||
Reference in New Issue
Block a user