change domen
This commit is contained in:
@@ -20,5 +20,5 @@ async def get_project(self: 'Usecase', input: dto.GetProjectInput) -> dto.Projec
|
||||
title=project.channel.title,
|
||||
username=project.channel.username,
|
||||
status=project.status,
|
||||
invite_link_type=project.invite_link_type,
|
||||
purchase_invite_type_default=project.purchase_invite_type_default,
|
||||
)
|
||||
|
||||
@@ -6,9 +6,7 @@ if TYPE_CHECKING:
|
||||
from .. import Usecase
|
||||
|
||||
|
||||
async def get_workspace_projects(
|
||||
self: 'Usecase', input: dto.GetWorkspaceProjectsInput
|
||||
) -> list[dto.ProjectOutput]:
|
||||
async def get_workspace_projects(self: 'Usecase', input: dto.GetWorkspaceProjectsInput) -> list[dto.ProjectOutput]:
|
||||
context = await self.ensure_workspace_permission(
|
||||
input.workspace_id, input.user_id, domain.PermissionKey.PROJECTS_READ
|
||||
)
|
||||
@@ -24,7 +22,7 @@ async def get_workspace_projects(
|
||||
title=project.channel.title,
|
||||
username=project.channel.username,
|
||||
status=project.status,
|
||||
invite_link_type=project.invite_link_type,
|
||||
purchase_invite_type_default=project.purchase_invite_type_default,
|
||||
)
|
||||
for project in projects
|
||||
]
|
||||
|
||||
@@ -104,8 +104,6 @@ async def tg_add_project(self: 'Usecase', input: dto.ConnectProjectInput) -> dto
|
||||
)
|
||||
await self.database.create_project(project)
|
||||
|
||||
await self.ensure_active_purchase_plan(project)
|
||||
|
||||
log.info(
|
||||
'Project for channel %s connected/updated successfully in workspace %s by user %s',
|
||||
input.telegram_id,
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
import uuid
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from src import domain
|
||||
from src import domain, dto
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .. import Usecase
|
||||
@@ -14,9 +14,9 @@ async def update_project_invite_link_type(
|
||||
self: 'Usecase',
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
invite_link_type: domain.InviteLinkType,
|
||||
purchase_invite_type_default: domain.purchase.InviteLinkType,
|
||||
user_id: uuid.UUID,
|
||||
) -> domain.Project:
|
||||
) -> dto.ProjectOutput:
|
||||
await self.ensure_workspace_permission(
|
||||
workspace_id,
|
||||
user_id,
|
||||
@@ -24,19 +24,19 @@ async def update_project_invite_link_type(
|
||||
for_project_id=project_id,
|
||||
)
|
||||
|
||||
async with self.database.transaction():
|
||||
project = await self.database.get_project(workspace_id, project_id=project_id)
|
||||
if not project:
|
||||
raise domain.ProjectNotFound(project_id)
|
||||
project = await self.database.get_project(workspace_id, project_id=project_id)
|
||||
if not project:
|
||||
raise domain.ProjectNotFound(project_id)
|
||||
|
||||
project.invite_link_type = invite_link_type
|
||||
await project.save()
|
||||
project.purchase_invite_type_default = purchase_invite_type_default
|
||||
|
||||
log.info(
|
||||
'Project %s invite_link_type updated to %s by user %s',
|
||||
project_id,
|
||||
invite_link_type,
|
||||
user_id,
|
||||
)
|
||||
await self.database.update_project(project)
|
||||
|
||||
return project
|
||||
return dto.ProjectOutput(
|
||||
id=project.id,
|
||||
telegram_id=project.channel.telegram_id,
|
||||
title=project.channel.title,
|
||||
username=project.channel.username,
|
||||
status=project.status,
|
||||
purchase_invite_type_default=project.purchase_invite_type_default,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user