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:
@@ -9,7 +9,7 @@ use uuid::Uuid;
|
||||
|
||||
use application::wrapup::{
|
||||
commands::RequestWrapUpCommand,
|
||||
generate, get_wrapup,
|
||||
delete as delete_wrapup, generate, get_wrapup,
|
||||
list_wrapups::{self, ListWrapUpsQuery},
|
||||
};
|
||||
use domain::errors::DomainError;
|
||||
@@ -194,6 +194,26 @@ pub async fn get_video(State(state): State<AppState>, Path(id): Path<Uuid>) -> i
|
||||
}
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
delete, path = "/api/v1/wrapups/{id}",
|
||||
params(("id" = Uuid, Path, description = "Wrap-up ID")),
|
||||
responses(
|
||||
(status = 204, description = "Deleted"),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 403, description = "Forbidden — admin only"),
|
||||
(status = 404, description = "Not found"),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn delete_wrapup_handler(
|
||||
State(state): State<AppState>,
|
||||
_admin: AdminApiUser,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<StatusCode, ApiError> {
|
||||
delete_wrapup::execute(&state.app_ctx, WrapUpId::from_uuid(id)).await?;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
// ── HTML handlers ───────────────────────────────────────────────────────────
|
||||
|
||||
fn format_watch_time(minutes: u32) -> String {
|
||||
|
||||
@@ -8,6 +8,7 @@ use utoipa::OpenApi;
|
||||
crate::handlers::wrapup::get_status,
|
||||
crate::handlers::wrapup::get_report,
|
||||
crate::handlers::wrapup::get_video,
|
||||
crate::handlers::wrapup::delete_wrapup_handler,
|
||||
),
|
||||
components(schemas(
|
||||
api_types::wrapup::GenerateWrapUpRequest,
|
||||
|
||||
@@ -360,7 +360,11 @@ fn api_routes(rate_limit: u64) -> Router<AppState> {
|
||||
routing::post(handlers::wrapup::post_generate),
|
||||
)
|
||||
.route("/wrapups", routing::get(handlers::wrapup::get_list))
|
||||
.route("/wrapups/{id}", routing::get(handlers::wrapup::get_status))
|
||||
.route(
|
||||
"/wrapups/{id}",
|
||||
routing::get(handlers::wrapup::get_status)
|
||||
.delete(handlers::wrapup::delete_wrapup_handler),
|
||||
)
|
||||
.route(
|
||||
"/wrapups/{id}/report",
|
||||
routing::get(handlers::wrapup::get_report),
|
||||
|
||||
@@ -629,6 +629,15 @@ impl domain::ports::WrapUpRepository for Panic {
|
||||
) -> Result<Option<domain::models::wrapup::WrapUpRecord>, DomainError> {
|
||||
panic!()
|
||||
}
|
||||
async fn delete(&self, _: &domain::value_objects::WrapUpId) -> Result<(), DomainError> {
|
||||
panic!()
|
||||
}
|
||||
async fn delete_failed_older_than(
|
||||
&self,
|
||||
_: chrono::NaiveDateTime,
|
||||
) -> Result<u64, DomainError> {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
// --- Single state factory — only auth_service varies ---
|
||||
|
||||
Reference in New Issue
Block a user