完善 server-rs DDD 重构计划与骨架

This commit is contained in:
Codex
2026-04-29 11:51:30 +08:00
parent 39200ea9cc
commit aa2e9b36d7
98 changed files with 1261 additions and 11 deletions

View File

@@ -0,0 +1,8 @@
//! 资产应用编排落位。
//!
//! 这里只组合纯校验与应用结果;对象探测、签名和持久化由 adapter 层完成。
pub use crate::asset_object_core::{
AssetEntityBindingProcedureResult, AssetHistoryListResult, AssetObjectProcedureResult,
ConfirmAssetObjectResult, build_asset_entity_binding_input, build_asset_object_upsert_input,
};

View File

@@ -0,0 +1,7 @@
//! 资产写入命令落位。
//!
//! 用于表达确认资产对象、绑定实体槽位和查询资产历史的输入,不直接访问 OSS。
pub use crate::asset_object_core::{
AssetEntityBindingInput, AssetHistoryListInput, AssetObjectUpsertInput, ConfirmAssetObjectInput,
};

View File

@@ -0,0 +1,15 @@
//! 资产领域模型落位。
//!
//! 当前先通过本文件承接对外领域 API 分层导出,旧实现仍留在
//! `asset_object_core.rs` 内部文件中,后续再逐段搬入本文件或 `domain/` 子目录。
//! 本层只允许保留资产对象、实体绑定、访问策略、版本和业务归属等纯规则。
pub use crate::asset_object_core::{
ASSET_BINDING_ID_PREFIX, ASSET_OBJECT_ID_PREFIX, AssetEntityBindingRecord,
AssetEntityBindingSnapshot, AssetHistoryEntryRecord, AssetHistoryEntrySnapshot,
AssetObjectAccessPolicy, AssetObjectRecord, AssetObjectUpsertSnapshot,
INITIAL_ASSET_OBJECT_VERSION, build_asset_entity_binding_record,
build_asset_history_entry_record, build_asset_object_record, generate_asset_binding_id,
generate_asset_object_id, normalize_optional_value, validate_asset_entity_binding_fields,
validate_asset_object_fields,
};

View File

@@ -0,0 +1,5 @@
//! 资产领域错误落位。
//!
//! 字段错误和业务错误在这里收口HTTP 状态码与 SpacetimeDB 字符串错误由 adapter 映射。
pub use crate::asset_object_core::AssetObjectFieldError;

View File

@@ -0,0 +1,4 @@
//! 资产领域事件过渡落位。
//!
//! 用于表达资产已确认、绑定已变更和资产历史投影待刷新等事实。
//! 当前阶段暂不新增事件类型,避免在 SpacetimeDB 表未补 event table 前扩散未消费 API。

View File

@@ -1,20 +1,31 @@
mod application;
mod commands;
mod domain;
mod errors;
mod events;
mod asset_object_core;
#[cfg(feature = "server-service")]
mod asset_object_service;
pub use asset_object_core::{
ASSET_BINDING_ID_PREFIX, ASSET_OBJECT_ID_PREFIX, AssetEntityBindingInput,
AssetEntityBindingProcedureResult, AssetEntityBindingRecord, AssetEntityBindingSnapshot,
AssetHistoryEntryRecord, AssetHistoryEntrySnapshot, AssetHistoryListInput,
AssetHistoryListResult, AssetObjectAccessPolicy, AssetObjectFieldError,
AssetObjectProcedureResult, AssetObjectRecord, AssetObjectUpsertInput,
AssetObjectUpsertSnapshot, ConfirmAssetObjectInput, ConfirmAssetObjectResult,
INITIAL_ASSET_OBJECT_VERSION, build_asset_entity_binding_input,
build_asset_entity_binding_record, build_asset_history_entry_record, build_asset_object_record,
build_asset_object_upsert_input, generate_asset_binding_id, generate_asset_object_id,
normalize_optional_value, validate_asset_entity_binding_fields, validate_asset_object_fields,
pub use application::{
AssetEntityBindingProcedureResult, AssetHistoryListResult, AssetObjectProcedureResult,
ConfirmAssetObjectResult, build_asset_entity_binding_input, build_asset_object_upsert_input,
};
#[cfg(feature = "server-service")]
pub use asset_object_service::{
AssetObjectService, ConfirmAssetObjectError, InMemoryAssetObjectStore,
};
pub use commands::{
AssetEntityBindingInput, AssetHistoryListInput, AssetObjectUpsertInput, ConfirmAssetObjectInput,
};
pub use domain::{
ASSET_BINDING_ID_PREFIX, ASSET_OBJECT_ID_PREFIX, AssetEntityBindingRecord,
AssetEntityBindingSnapshot, AssetHistoryEntryRecord, AssetHistoryEntrySnapshot,
AssetObjectAccessPolicy, AssetObjectRecord, AssetObjectUpsertSnapshot,
INITIAL_ASSET_OBJECT_VERSION, build_asset_entity_binding_record,
build_asset_history_entry_record, build_asset_object_record, generate_asset_binding_id,
generate_asset_object_id, normalize_optional_value, validate_asset_entity_binding_fields,
validate_asset_object_fields,
};
pub use errors::AssetObjectFieldError;