Added Account::get method
This commit is contained in:
@ -129,4 +129,17 @@ impl Entity {
|
||||
.await?;
|
||||
Ok(result.is_some())
|
||||
}
|
||||
|
||||
pub async fn get(
|
||||
user_id: u64,
|
||||
account_name: impl Into<String>,
|
||||
db: &DatabaseConnection,
|
||||
) -> crate::Result<Option<Model>> {
|
||||
Self::find()
|
||||
.filter(Column::UserId.eq(user_id))
|
||||
.filter(Column::Name.eq(account_name.into()))
|
||||
.one(db)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user