cargo clippy fix
This commit is contained in:
@@ -51,20 +51,20 @@ impl Model {
|
||||
.await
|
||||
}
|
||||
pub async fn get_all_active_sessions(db: &DatabaseConnection) -> Result<Vec<Model>, DbErr> {
|
||||
Ok(Entity::find()
|
||||
Entity::find()
|
||||
.filter(Column::EndedAt.is_null())
|
||||
.all(db)
|
||||
.await?)
|
||||
.await
|
||||
}
|
||||
pub async fn get_active_by_stream_key_id(
|
||||
db: &DatabaseConnection,
|
||||
stream_key_id: i32,
|
||||
) -> Result<Option<Model>, DbErr> {
|
||||
Ok(Entity::find()
|
||||
Entity::find()
|
||||
.filter(Column::StreamKeyId.eq(stream_key_id))
|
||||
.filter(Column::EndedAt.is_null())
|
||||
.one(db)
|
||||
.await?)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn clean_unended_streams(db: &DatabaseConnection) -> Result<u64, DbErr> {
|
||||
|
||||
@@ -58,18 +58,18 @@ impl Entity {
|
||||
if let Some(x) = sessions {
|
||||
Entity::find_by_id(x.id_user).one(db).await
|
||||
} else {
|
||||
return Ok(None);
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
pub async fn find_by_username(
|
||||
db: &DatabaseConnection,
|
||||
username: String,
|
||||
) -> Result<Option<Model>, DbErr> {
|
||||
let user = Entity::find()
|
||||
|
||||
Entity::find()
|
||||
.filter(Column::Username.eq(username))
|
||||
.one(db)
|
||||
.await;
|
||||
user
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user