refactor: code smell fixes — tests, events, naming
- Tests for ExecutePipelineHandler (happy path, fallback, disabled skip, failure retry, not found) - Tests for ProcessNextJobHandler (empty queue, process, drain multiple) - DerivativeGenerated domain event + event-payload mapping + event_store aggregate - Renamed event-payload → adapters-event-payload, event-transport → adapters-event-transport
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "event-payload"
|
||||
name = "adapters-event-payload"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@ pub enum EventPayload {
|
||||
asset_id: String,
|
||||
timestamp: String,
|
||||
},
|
||||
DerivativeGenerated {
|
||||
asset_id: String,
|
||||
derivative_id: String,
|
||||
profile: String,
|
||||
timestamp: String,
|
||||
},
|
||||
JobEnqueued {
|
||||
job_id: String,
|
||||
job_type: String,
|
||||
@@ -59,6 +65,7 @@ impl EventPayload {
|
||||
Self::ShareCreated { .. } => "shares.created",
|
||||
Self::ShareRevoked { .. } => "shares.revoked",
|
||||
Self::SidecarSyncRequested { .. } => "sidecars.sync_requested",
|
||||
Self::DerivativeGenerated { .. } => "derivatives.generated",
|
||||
Self::JobEnqueued { .. } => "jobs.enqueued",
|
||||
Self::JobCompleted { .. } => "jobs.completed",
|
||||
Self::JobFailed { .. } => "jobs.failed",
|
||||
@@ -123,6 +130,17 @@ impl From<&DomainEvent> for EventPayload {
|
||||
asset_id: asset_id.to_string(),
|
||||
timestamp: timestamp.to_string(),
|
||||
},
|
||||
DomainEvent::DerivativeGenerated {
|
||||
asset_id,
|
||||
derivative_id,
|
||||
profile,
|
||||
timestamp,
|
||||
} => Self::DerivativeGenerated {
|
||||
asset_id: asset_id.to_string(),
|
||||
derivative_id: derivative_id.to_string(),
|
||||
profile: profile.clone(),
|
||||
timestamp: timestamp.to_string(),
|
||||
},
|
||||
DomainEvent::JobEnqueued {
|
||||
job_id,
|
||||
job_type,
|
||||
@@ -222,6 +240,17 @@ impl TryFrom<EventPayload> for DomainEvent {
|
||||
asset_id: SystemId::from_uuid(parse_uuid(&asset_id, "asset_id")?),
|
||||
timestamp: parse_timestamp(×tamp)?,
|
||||
},
|
||||
EventPayload::DerivativeGenerated {
|
||||
asset_id,
|
||||
derivative_id,
|
||||
profile,
|
||||
timestamp,
|
||||
} => DomainEvent::DerivativeGenerated {
|
||||
asset_id: SystemId::from_uuid(parse_uuid(&asset_id, "asset_id")?),
|
||||
derivative_id: SystemId::from_uuid(parse_uuid(&derivative_id, "derivative_id")?),
|
||||
profile,
|
||||
timestamp: parse_timestamp(×tamp)?,
|
||||
},
|
||||
EventPayload::JobEnqueued {
|
||||
job_id,
|
||||
job_type,
|
||||
|
||||
Reference in New Issue
Block a user