feat: add workspace

This commit is contained in:
Artem Tsyrulnikov
2025-12-13 22:09:55 +03:00
parent 2fdd56c3e0
commit af32e2a507
55 changed files with 677 additions and 227 deletions

View File

@@ -33,12 +33,16 @@ def _format_period(dt: 'datetime.datetime', grouping: dto.DateGrouping) -> str:
async def get_spending_analytics(
self: 'Usecase', input: dto.GetSpendingAnalyticsInput
) -> dto.GetSpendingAnalyticsOutput:
await self.ensure_workspace_access(input.workspace_id, input.user_id)
if input.target_channel_id:
target_channel = await self.database.get_target_channel(input.user_id, input.target_channel_id)
target_channel = await self.database.get_target_channel(input.workspace_id, input.target_channel_id)
if not target_channel:
raise domain.TargetChannelNotFound(input.target_channel_id)
placements = await self.database.get_user_placements(input.user_id, input.target_channel_id, include_archived=False)
placements = await self.database.get_workspace_placements(
input.workspace_id, input.target_channel_id, include_archived=False
)
filtered = [
p