Close DDD refactor and remove generated asset proxy

This commit is contained in:
kdletters
2026-05-02 00:27:22 +08:00
parent fd08262bf0
commit 9d9913095d
605 changed files with 11811 additions and 10106 deletions

View File

@@ -116,6 +116,8 @@ fn upsert_asset_entity_binding(
}
};
emit_asset_entity_binding_changed_event(ctx, &snapshot);
Ok(snapshot)
}
@@ -133,3 +135,37 @@ fn build_asset_entity_binding_row(snapshot: &AssetEntityBindingSnapshot) -> Asse
updated_at: Timestamp::from_micros_since_unix_epoch(snapshot.updated_at_micros),
}
}
fn emit_asset_entity_binding_changed_event(
ctx: &ReducerContext,
snapshot: &AssetEntityBindingSnapshot,
) {
let event = AssetEntityBindingChangedEvent {
binding_id: snapshot.binding_id.clone(),
asset_object_id: snapshot.asset_object_id.clone(),
entity_kind: snapshot.entity_kind.clone(),
entity_id: snapshot.entity_id.clone(),
slot: snapshot.slot.clone(),
asset_kind: snapshot.asset_kind.clone(),
owner_user_id: snapshot.owner_user_id.clone(),
profile_id: snapshot.profile_id.clone(),
occurred_at_micros: snapshot.updated_at_micros,
};
ctx.db.asset_event().insert(AssetEvent {
event_id: format!(
"assetevt_{}_{}_binding",
event.binding_id, event.occurred_at_micros
),
asset_object_id: event.asset_object_id,
binding_id: Some(event.binding_id),
event_kind: AssetEventKind::EntityBindingChanged,
asset_kind: event.asset_kind,
owner_user_id: event.owner_user_id,
profile_id: event.profile_id,
entity_kind: Some(event.entity_kind),
entity_id: Some(event.entity_id),
slot: Some(event.slot),
occurred_at: Timestamp::from_micros_since_unix_epoch(event.occurred_at_micros),
});
}