collab: Don't try to sync usage to Stripe for staff users (#29892)

This PR makes it so we don't try to sync billing usage to Stripe for
staff users.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-04 19:14:24 -04:00 committed by GitHub
parent 76ad1a29a5
commit 3594a52bee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View file

@ -65,6 +65,18 @@ impl Database {
.await
}
/// Returns all users flagged as staff.
pub async fn get_staff_users(&self) -> Result<Vec<user::Model>> {
self.transaction(|tx| async {
let tx = tx;
Ok(user::Entity::find()
.filter(user::Column::Admin.eq(true))
.all(&*tx)
.await?)
})
.await
}
/// Returns a user by email address. There are no access checks here, so this should only be used internally.
pub async fn get_user_by_email(&self, email: &str) -> Result<Option<User>> {
self.transaction(|tx| async move {