billing_preferences.rs
1use super::*;
2
3impl Database {
4 /// Returns the billing preferences for the given user, if they exist.
5 pub async fn get_billing_preferences(
6 &self,
7 user_id: UserId,
8 ) -> Result<Option<billing_preference::Model>> {
9 self.transaction(|tx| async move {
10 Ok(billing_preference::Entity::find()
11 .filter(billing_preference::Column::UserId.eq(user_id))
12 .one(&*tx)
13 .await?)
14 })
15 .await
16 }
17}