Bump: 0.5.0 : unlisted, password and locked stream support

This commit is contained in:
2026-08-16 14:56:29 +01:00
parent 9960434c1c
commit 0c6705badd
13 changed files with 319 additions and 45 deletions
+25
View File
@@ -12,6 +12,8 @@ pub struct Model {
pub label: String,
pub is_active: bool,
pub is_unlisted: bool,
pub password: Option<String>,
pub custom_id: Option<String>,
pub created_at: DateTimeUtc,
}
@@ -78,6 +80,16 @@ impl Entity {
.all(db)
.await
}
pub async fn find_by_custom_id(
db: &DatabaseConnection,
custom_id: String,
) -> Result<Option<Model>, DbErr> {
Entity::find()
.filter(Column::CustomId.eq(custom_id))
.one(db)
.await
}
}
impl ActiveModel {
@@ -89,4 +101,17 @@ impl ActiveModel {
self.label = Set(value);
self.update(db).await
}
pub async fn password(
mut self,
db: &DatabaseConnection,
value: String,
) -> Result<Model, DbErr> {
self.password = if value.is_empty() {
Set(None)
} else {
Set(Some(value))
};
self.update(db).await
}
}