work
This commit is contained in:
parent
d042430f0c
commit
e32c3825a0
2 changed files with 17 additions and 13 deletions
2
docs/Webhooks.md
Normal file
2
docs/Webhooks.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Webhooks
|
||||
Certain events can trigger webhooks. This allows you to independently build your automation pipeline.
|
28
src/item.rs
28
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<String> 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();
|
||||
|
|
Loading…
Reference in a new issue