webhooks
This commit is contained in:
parent
37475460e2
commit
02966c0605
9 changed files with 340 additions and 13 deletions
|
@ -125,11 +125,11 @@ impl Variant {
|
|||
ret
|
||||
}
|
||||
|
||||
pub async fn demand(uuid: &str, price: Price, destination: &str) -> Option<()> {
|
||||
pub async fn demand(uuid: &str, price: Price, destination: &str) -> Option<Transaction> {
|
||||
// check if transaction exists
|
||||
let mut t = Transaction::get(uuid).await?;
|
||||
t.consume(price, destination).await;
|
||||
Some(())
|
||||
t = t.consume(price, destination).await;
|
||||
Some(t)
|
||||
}
|
||||
|
||||
/// Records a supply transaction in the database.
|
||||
|
@ -147,12 +147,12 @@ impl Variant {
|
|||
price: Price,
|
||||
origin: Option<&str>,
|
||||
location: Option<&str>,
|
||||
) -> String {
|
||||
) -> Transaction {
|
||||
let t = Transaction::new(&self.item, &self.variant, price, origin, location).await;
|
||||
|
||||
t.insert().await.unwrap();
|
||||
|
||||
t._id
|
||||
t
|
||||
}
|
||||
|
||||
pub async fn get_all_transactions(&self) -> Vec<Transaction> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue