feat: implement find_all method in ChannelRepository and update related services and routes for public access
This commit is contained in:
@@ -36,6 +36,7 @@ pub trait UserRepository: Send + Sync {
|
||||
pub trait ChannelRepository: Send + Sync {
|
||||
async fn find_by_id(&self, id: ChannelId) -> DomainResult<Option<Channel>>;
|
||||
async fn find_by_owner(&self, owner_id: UserId) -> DomainResult<Vec<Channel>>;
|
||||
async fn find_all(&self) -> DomainResult<Vec<Channel>>;
|
||||
/// Insert or update a channel.
|
||||
async fn save(&self, channel: &Channel) -> DomainResult<()>;
|
||||
async fn delete(&self, id: ChannelId) -> DomainResult<()>;
|
||||
|
||||
@@ -112,6 +112,10 @@ impl ChannelService {
|
||||
.ok_or(DomainError::ChannelNotFound(id))
|
||||
}
|
||||
|
||||
pub async fn find_all(&self) -> DomainResult<Vec<crate::entities::Channel>> {
|
||||
self.channel_repo.find_all().await
|
||||
}
|
||||
|
||||
pub async fn find_by_owner(
|
||||
&self,
|
||||
owner_id: crate::value_objects::UserId,
|
||||
|
||||
Reference in New Issue
Block a user