diff --git a/docs/Webhooks.md b/docs/Webhooks.md new file mode 100644 index 0000000..edd734d --- /dev/null +++ b/docs/Webhooks.md @@ -0,0 +1,2 @@ +# Webhooks +Certain events can trigger webhooks. This allows you to independently build your automation pipeline. \ No newline at end of file diff --git a/src/item.rs b/src/item.rs index 35aea2f..1b04f95 100644 --- a/src/item.rs +++ b/src/item.rs @@ -5,18 +5,6 @@ use mongodb::{bson::doc, ClientSession, Collection}; // todo : api key auth -// case: itemset -// items describe generic top level structure - -// case: item variants -// specific instance of an item (real world) -// possibly deviating attrs - -// case: import -// made / bought an item -> supply -// check in with attrs -> uuid (transaction) -// commited to db - // case: export // used an item -> demand // mark as used @@ -108,6 +96,11 @@ impl ItemEntry { } } +/// Represents a single item in a collection of physical goods. +/// +/// This struct serves as a blueprint for describing individual items within +/// a larger inventory or database of physical goods. It includes fields for +/// the name of the item and its category. pub struct Item { db: mongodb::Client, pub item: ItemEntry, @@ -266,6 +259,12 @@ impl From for Price { } } +/// Represents a specific instance of an item with potential variations. +/// +/// This struct is used to describe a particular variation or instance of an item +/// in the real world. It may include attributes or properties that deviate from +/// the standard definition of the item. For example, different colors, sizes, or +/// configurations. pub struct Variant { pub item: String, pub variant: String, @@ -376,8 +375,11 @@ impl Variant { todo!() } + // case: import + // made / bought an item -> supply + // check in with attrs -> uuid (transaction) + // commited to db pub async fn supply(&self, amount: usize, price: Price, origin: &str) -> String { - // todo : implement db transactions let db = get_mongo!(); let mut ses = db.start_session(None).await.unwrap();