collab: Improve GET /billing/usage endpoint (#29898)

This PR improves the `GET /billing/usage` endpoint.

We now return the usage with the default plan limits when there is no
usage record.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-04 22:31:02 -04:00 committed by GitHub
parent 55eb0710ed
commit 45fe158bc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 69 additions and 42 deletions

View file

@ -61,6 +61,16 @@ pub enum SubscriptionKind {
ZedFree,
}
impl From<SubscriptionKind> for zed_llm_client::Plan {
fn from(value: SubscriptionKind) -> Self {
match value {
SubscriptionKind::ZedPro => Self::ZedPro,
SubscriptionKind::ZedProTrial => Self::ZedProTrial,
SubscriptionKind::ZedFree => Self::Free,
}
}
}
/// The status of a Stripe subscription.
///
/// [Stripe docs](https://docs.stripe.com/api/subscriptions/object#subscription_object-status)