Skip to content

Commit

Permalink
Change registration to action
Browse files Browse the repository at this point in the history
  • Loading branch information
erikh360 committed Jul 16, 2024
1 parent fb0d2ea commit 12049c0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.13 on 2024-07-16 09:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("eventstore", "0066_whatsapptemplatesendstatus_status"),
]

operations = [
migrations.RenameField(
model_name="whatsapptemplatesendstatus",
old_name="registration_completed_at",
new_name="action_completed_at",
),
migrations.AlterField(
model_name="whatsapptemplatesendstatus",
name="status",
field=models.CharField(
choices=[
("wired", "Message wired"),
("event_received", "Event received"),
("action_completed", "Action completed"),
],
default="wired",
max_length=30,
),
),
]
6 changes: 3 additions & 3 deletions eventstore/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,18 +1130,18 @@ class WhatsAppTemplateSendStatus(models.Model):
class Status:
WIRED = "wired"
EVENT_RECEIVED = "event_received"
REGISTRATION_COMPLETED = "registration_completed"
ACTION_COMPLETED = "action_completed"
choices = (
(WIRED, "Message wired"),
(EVENT_RECEIVED, "Event received"),
(REGISTRATION_COMPLETED, "Registration completed"),
(ACTION_COMPLETED, "Action completed"),
)

id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
message_id = models.CharField(max_length=255, blank=True)
sent_at = models.DateTimeField(auto_now_add=True)
event_received_at = models.DateTimeField(null=True)
registration_completed_at = models.DateTimeField(null=True)
action_completed_at = models.DateTimeField(null=True)
preferred_channel = models.CharField(
max_length=8, choices=CHANNEL_TYPES, default=WHATSAPP_CHANNELTYPE
)
Expand Down
8 changes: 4 additions & 4 deletions eventstore/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3239,14 +3239,14 @@ def test_change_object(self):
response = self.client.patch(
self.url,
{
"registration_completed_at": timezone.now(),
"status": WhatsAppTemplateSendStatus.Status.REGISTRATION_COMPLETED,
"action_completed_at": timezone.now(),
"status": WhatsAppTemplateSendStatus.Status.ACTION_COMPLETED,
},
)

self.status.refresh_from_db()
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIsNotNone(self.status.registration_completed_at)
self.assertIsNotNone(self.status.action_completed_at)
self.assertEqual(
self.status.status, WhatsAppTemplateSendStatus.Status.REGISTRATION_COMPLETED
self.status.status, WhatsAppTemplateSendStatus.Status.ACTION_COMPLETED
)

0 comments on commit 12049c0

Please sign in to comment.