Close DDD cleanup and tests-support closure
This commit is contained in:
@@ -1,3 +1,61 @@
|
||||
//! 背包写入命令过渡落位。
|
||||
//! 背包写入命令。
|
||||
//!
|
||||
//! 用于表达授予物品、装备、卸下、消耗和整理等输入。
|
||||
|
||||
use crate::domain::InventoryItemSnapshot;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "spacetime-types")]
|
||||
use spacetimedb::SpacetimeType;
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct GrantInventoryItemInput {
|
||||
pub slot_id: String,
|
||||
pub item: InventoryItemSnapshot,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ConsumeInventoryItemInput {
|
||||
pub slot_id: String,
|
||||
pub quantity: u32,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct EquipInventoryItemInput {
|
||||
pub slot_id: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct UnequipInventoryItemInput {
|
||||
pub slot_id: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum InventoryMutation {
|
||||
GrantItem(GrantInventoryItemInput),
|
||||
ConsumeItem(ConsumeInventoryItemInput),
|
||||
EquipItem(EquipInventoryItemInput),
|
||||
UnequipItem(UnequipInventoryItemInput),
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct InventoryMutationInput {
|
||||
pub mutation_id: String,
|
||||
pub runtime_session_id: String,
|
||||
pub story_session_id: Option<String>,
|
||||
pub actor_user_id: String,
|
||||
pub mutation: InventoryMutation,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct RuntimeInventoryStateQueryInput {
|
||||
pub runtime_session_id: String,
|
||||
pub actor_user_id: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user