Skip to content

Commit

Permalink
commit merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJaeger committed Feb 4, 2025
2 parents 76aceeb + a04d94e commit 56ca1f8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions chats/apps/api/v1/projects/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,26 @@ def integrate_sectors(self, request, *args, **kwargs):
)

return Response("ticketers and topics integrated", status=status.HTTP_200_OK)

@action(
detail=True,
methods=["post"],
url_path="set-project-principal",
)
def set_project_as_principal(self, request, *args, **kwargs):
project = self.get_object()

config = project.config or {}
config["its_principal"] = True
project.config = config
project.save()

org_projects = Project.objects.filter(org=project.org).exclude(pk=project.pk)
org_projects.update(config={"its_secundary": True})

return Response(
{
"detail": "Project set as principal and other projects in the same org set as secondary."
},
status=status.HTTP_200_OK,
)

0 comments on commit 56ca1f8

Please sign in to comment.