feat: creatives and external channels
This commit is contained in:
24
src/usecase/target_channel/get_user_target_chans.py
Normal file
24
src/usecase/target_channel/get_user_target_chans.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from src import dto
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .. import Usecase
|
||||
|
||||
|
||||
async def get_user_target_chans(self: 'Usecase', input: dto.GetUserTargetChansInput) -> dto.GetUserTargetChansOutput:
|
||||
async with self.database.transaction():
|
||||
channels = await self.database.get_user_target_channels(input.user_id)
|
||||
|
||||
return dto.GetUserTargetChansOutput(
|
||||
target_channels=[
|
||||
dto.ConnectTargetChanOutput(
|
||||
id=channel.id,
|
||||
telegram_id=channel.telegram_id,
|
||||
title=channel.title,
|
||||
username=channel.username,
|
||||
is_active=channel.is_active,
|
||||
)
|
||||
for channel in channels
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user