collab: Add GET /billing/usage
endpoint (#28832)
This PR adds a `GET /billing/usage` endpoint for retrieving billing usage to show on the `zed.dev/account` page. Release Notes: - N/A
This commit is contained in:
parent
222d4a2546
commit
b486e32f05
7 changed files with 148 additions and 7 deletions
|
@ -19,6 +19,18 @@ pub struct Model {
|
|||
pub created_at: DateTime,
|
||||
}
|
||||
|
||||
impl Model {
|
||||
pub fn current_period_start_at(&self) -> Option<DateTimeUtc> {
|
||||
let period_start = self.stripe_current_period_start?;
|
||||
chrono::DateTime::from_timestamp(period_start, 0)
|
||||
}
|
||||
|
||||
pub fn current_period_end_at(&self) -> Option<DateTimeUtc> {
|
||||
let period_end = self.stripe_current_period_end?;
|
||||
chrono::DateTime::from_timestamp(period_end, 0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue