diff --git a/chats/apps/api/v1/internal/rest_clients/flows_rest_client.py b/chats/apps/api/v1/internal/rest_clients/flows_rest_client.py index ca62410c..e13b42b3 100644 --- a/chats/apps/api/v1/internal/rest_clients/flows_rest_client.py +++ b/chats/apps/api/v1/internal/rest_clients/flows_rest_client.py @@ -51,11 +51,11 @@ def retry_request_and_refresh_flows_auth_token( class FlowsQueueMixin: - def create_queue(self, uuid: str, name: str, sector_uuid: str): + def create_queue(self, uuid: str, name: str, sector_uuid: str, project_uuid: str): response = requests.post( url=f"{self.base_url}/api/v2/internals/ticketers/{sector_uuid}/queues/", headers=self.headers, - json={"uuid": uuid, "name": name}, + json={"uuid": uuid, "name": name, "project_uuid": project_uuid}, ) if response.status_code not in [ status.HTTP_200_OK, diff --git a/chats/apps/api/v1/queues/viewsets.py b/chats/apps/api/v1/queues/viewsets.py index a0fdec9f..b7b449b8 100644 --- a/chats/apps/api/v1/queues/viewsets.py +++ b/chats/apps/api/v1/queues/viewsets.py @@ -64,6 +64,7 @@ def perform_create(self, serializer): "uuid": str(instance.uuid), "name": instance.name, "sector_uuid": str(instance.sector.uuid), + "project_uuid": str(instance.sector.project.uuid), } if not settings.USE_WENI_FLOWS: return super().perform_create(serializer) diff --git a/chats/apps/projects/migrations/0020_project_org.py b/chats/apps/projects/migrations/0020_project_org.py new file mode 100644 index 00000000..2465105d --- /dev/null +++ b/chats/apps/projects/migrations/0020_project_org.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.2 on 2024-10-29 18:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("projects", "0019_flowstart_contact_data"), + ] + + operations = [ + migrations.AddField( + model_name="project", + name="org", + field=models.CharField( + blank=True, max_length=50, null=True, verbose_name="org uuid" + ), + ), + ] diff --git a/chats/apps/projects/models/models.py b/chats/apps/projects/models/models.py index cf029d34..816659be 100644 --- a/chats/apps/projects/models/models.py +++ b/chats/apps/projects/models/models.py @@ -60,6 +60,7 @@ class Project(BaseConfigurableModel, BaseModel): null=True, blank=True, ) + org = models.CharField(_("org uuid"), max_length=50, null=True, blank=True) class Meta: verbose_name = _("Project")