This commit is contained in:
2026-05-16 17:57:54 +02:00
parent 1a2ec26f27
commit b2cefb7d66
55 changed files with 1654 additions and 334 deletions
+7 -3
View File
@@ -15,6 +15,10 @@ impl ChannelRepository {
.await?)
}
pub async fn get_all(&self) -> AnyResult<Vec<channel::Model>> {
Ok(channel::Entity::find().all(&self.context.db).await?)
}
pub async fn update(&self, active: channel::ActiveModel) -> AnyResult<channel::Model> {
let channel = active.update(&self.context.db).await?;
self.context.events.emit("channel_updated", channel.clone());
@@ -27,11 +31,11 @@ impl ChannelRepository {
Ok(channel)
}
pub async fn delete(&self, id: uuid::Uuid) -> AnyResult<()> {
channel::Entity::delete_by_id(id)
pub async fn delete(&self, id: uuid::Uuid) -> AnyResult<bool> {
let res = channel::Entity::delete_by_id(id)
.exec(&self.context.db)
.await?;
self.context.events.emit("channel_deleted", id);
Ok(())
Ok(res.rows_affected > 0)
}
}