Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/room project UUID #395

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chats/apps/api/v1/external/rooms/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def create(self, validated_data):

room = Room.objects.create(
**validated_data,
project_uuid=str(project.uuid),
contact=contact,
queue=queue,
protocol=protocol,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.1.2 on 2024-09-30 19:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("rooms", "0012_room_service_chat"),
]

operations = [
migrations.AddField(
model_name="room",
name="project_uuid",
field=models.TextField(
blank=True, default="", null=True, verbose_name="project_uuid"
),
),
migrations.AddIndex(
model_name="room",
index=models.Index(
fields=["project_uuid"], name="rooms_room_project_890f5f_idx"
),
),
]
7 changes: 7 additions & 0 deletions chats/apps/rooms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __init__(self, *args, **kwargs):
)
urn = models.TextField(_("urn"), null=True, blank=True, default="")

project_uuid = models.TextField(
_("project_uuid"), null=True, blank=True, default=""
)

callback_url = models.TextField(_("Callback URL"), null=True, blank=True)

ended_at = models.DateTimeField(
Expand Down Expand Up @@ -86,6 +90,9 @@ class Meta:
name="unique_contact_queue_is_activetrue_room",
)
]
indexes = [
models.Index(fields=["project_uuid"]),
]

def save(self, *args, **kwargs) -> None:
if self.__original_is_active is False:
Expand Down
Loading