0.6 rust重构01
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
pub mod command;
|
||||
pub mod common;
|
||||
pub mod governance;
|
||||
pub mod query;
|
||||
pub mod tool;
|
||||
|
||||
pub use command::{
|
||||
CommandEnvelope, CreatePage, CreateWorkspace, DeleteBlock, InsertBlock, MoveBlock,
|
||||
UpdateBlock, UpdatePageStats, UpdatePageTitle,
|
||||
};
|
||||
pub use common::{
|
||||
ActorPayload, AffectedObject, ErrorDetail, ErrorPayload, OkPayload, RequestMeta, ResponseMeta,
|
||||
SourcePayload, TargetRef,
|
||||
};
|
||||
pub use query::{GetPage, ListPageBlocks, QueryEnvelope, SearchBlocks, SearchPages};
|
||||
pub use tool::{InvocationKind, ToolInvocation};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn command_envelope_keeps_validate_only_flag() {
|
||||
let envelope = CommandEnvelope::<CreateWorkspace> {
|
||||
name: "create_workspace".into(),
|
||||
command_id: "cmd_1".into(),
|
||||
idempotency_key: Some("idem_1".into()),
|
||||
actor: ActorPayload {
|
||||
actor_type: "human".into(),
|
||||
actor_id: "user_1".into(),
|
||||
session_id: Some("session_1".into()),
|
||||
},
|
||||
source: SourcePayload {
|
||||
channel: "cli".into(),
|
||||
client: "mnote-cli".into(),
|
||||
},
|
||||
target: None,
|
||||
payload: CreateWorkspace {
|
||||
name: "demo".into(),
|
||||
slug: Some("demo".into()),
|
||||
},
|
||||
reason: Some("初始化工作区".into()),
|
||||
refs: vec![],
|
||||
dry_run: false,
|
||||
validate_only: true,
|
||||
};
|
||||
|
||||
assert!(envelope.validate_only);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user