feat: wrapup date validation, delete endpoint, failed record cleanup
Some checks failed
CI / Check / Test (push) Failing after 41s
Some checks failed
CI / Check / Test (push) Failing after 41s
This commit is contained in:
19
crates/application/src/wrapup/delete.rs
Normal file
19
crates/application/src/wrapup/delete.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use domain::errors::DomainError;
|
||||
use domain::value_objects::WrapUpId;
|
||||
|
||||
use crate::context::AppContext;
|
||||
|
||||
pub async fn execute(ctx: &AppContext, id: WrapUpId) -> Result<(), DomainError> {
|
||||
let record = ctx
|
||||
.repos
|
||||
.wrapup_repo
|
||||
.get_by_id(&id)
|
||||
.await?
|
||||
.ok_or_else(|| DomainError::NotFound("wrap-up not found".into()))?;
|
||||
|
||||
let wrapup_key = format!("wrapups/{}", id.value());
|
||||
let video_key = format!("{wrapup_key}/video.mp4");
|
||||
let _ = ctx.services.image_storage.delete(&video_key).await;
|
||||
|
||||
ctx.repos.wrapup_repo.delete(&record.id).await
|
||||
}
|
||||
Reference in New Issue
Block a user