Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
set server uuid on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Oct 12, 2024
1 parent 1ed24f1 commit 2f2f488
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/routes/internal/billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,11 @@ pub async fn stripe_webhook(
format!("{}'s server", metadata.user_item.username)
});

#[derive(Deserialize)]
struct PyroServerResponse {
uuid: String,
}

let res = client
.post("https://archon.pyro.host/modrinth/v0/servers/create")
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
Expand All @@ -1333,7 +1338,14 @@ pub async fn stripe_webhook(
}))
.send()
.await?
.error_for_status()?;
.error_for_status()?
.json::<PyroServerResponse>()
.await?;

if let Some(ref mut subscription) = metadata.user_subscription_item {

Check failure on line 1345 in src/routes/internal/billing.rs

View workflow job for this annotation

GitHub Actions / clippy

cannot borrow `metadata.user_subscription_item.0` as mutable, as `metadata` is not declared as mutable

error[E0596]: cannot borrow `metadata.user_subscription_item.0` as mutable, as `metadata` is not declared as mutable --> src/routes/internal/billing.rs:1345:49 | 1345 | ... if let Some(ref mut subscription) = metadata.user_subscription_item { | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | help: consider changing this to be mutable | 1245 | let mut metadata = get_payment_intent_metadata( | +++
subscription.metadata = Some(SubscriptionMetadata::Pyro { id: res.uuid });
subscription.upsert(&mut transaction).await?;
}
}
}
}
Expand Down

0 comments on commit 2f2f488

Please sign in to comment.