Skip to content

Commit

Permalink
Merge pull request #288 from weni-ai/feature/verify-uuid-project-in-t…
Browse files Browse the repository at this point in the history
…emplate-type-creation

Checking if project exists in template type creation.
  • Loading branch information
AlanJaeger authored Sep 26, 2023
2 parents e9f6ea8 + e210ee9 commit 5a6cba0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chats/apps/projects/usecases/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .dead_letter_handler import DeadLetterHandler
from .exceptions import InvalidProjectData
from .exceptions import InvalidProjectData, InvalidTemplateTypeData
from .template_type_creation import TemplateTypeCreation
7 changes: 7 additions & 0 deletions chats/apps/projects/usecases/template_type_creation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
from chats.apps.projects.models import TemplateType
from chats.apps.sectors.models import Sector
from chats.apps.projects.models import Project
from chats.apps.projects.usecases import InvalidTemplateTypeData


class TemplateTypeCreation:
def __init__(self, config: dict) -> None:
self.config = config

def create(self) -> TemplateType:
try:
Project.objects.get(uuid=self.config.get("project_uuid"))
except Exception as err:
raise InvalidTemplateTypeData(err)

setup = {
"sectors": [
sector.template_type_setup
Expand Down

0 comments on commit 5a6cba0

Please sign in to comment.