Skip to content

Commit a90a9f0

Browse files
committed
Create status field to track OpenPix Webhook payload processing
1 parent aa58a75 commit a90a9f0

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 5.2.9 on 2025-12-08 19:53
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("webhooks", "0001_initial"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="openpixwebhookpayload",
15+
name="status",
16+
field=models.IntegerField(
17+
choices=[(1, "Received"), (2, "Processed")],
18+
default=1,
19+
verbose_name="Processing Status",
20+
),
21+
),
22+
]

thebook/webhooks/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
from django.db import models
2+
from django.utils.functional import classproperty
3+
from django.utils.translation import gettext as _
4+
5+
6+
class ProcessingStatus:
7+
RECEIVED = 1
8+
PROCESSED = 2
9+
10+
@classproperty
11+
def choices(cls):
12+
return (
13+
(cls.RECEIVED, _("Received")),
14+
(cls.PROCESSED, _("Processed")),
15+
)
216

317

418
class OpenPixWebhookPayload(models.Model):
519
thebook_token = models.CharField()
620
payload = models.CharField()
21+
status = models.IntegerField(
22+
choices=ProcessingStatus.choices,
23+
default=ProcessingStatus.RECEIVED,
24+
verbose_name=_("Processing Status"),
25+
)
26+
727
created_at = models.DateTimeField(auto_now_add=True)

0 commit comments

Comments
 (0)