138 lines
5.9 KiB
Python
138 lines
5.9 KiB
Python
# Generated by Django 5.2.16 on 2026-07-31 01:19
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = []
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="InboundEndpoint",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("name", models.CharField(max_length=255)),
|
|
("slug", models.SlugField(unique=True)),
|
|
(
|
|
"source",
|
|
models.CharField(
|
|
choices=[
|
|
("stripe", "Stripe"),
|
|
("github", "GitHub"),
|
|
("mercadopago", "Mercado Pago"),
|
|
("custom", "Custom"),
|
|
],
|
|
max_length=50,
|
|
),
|
|
),
|
|
("secret", models.CharField(max_length=500)),
|
|
("handler", models.CharField(max_length=500)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
],
|
|
options={
|
|
"db_table": "webhooks_inbound_endpoint",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OutboundEndpoint",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("name", models.CharField(max_length=255)),
|
|
("url", models.URLField(max_length=1000)),
|
|
("secret", models.CharField(max_length=500)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("retry_policy", models.JSONField(blank=True, default=dict)),
|
|
("headers", models.JSONField(blank=True, default=dict)),
|
|
("timeout_seconds", models.PositiveIntegerField(default=30)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
],
|
|
options={
|
|
"db_table": "webhooks_outbound_endpoint",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="InboundEvent",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("event_type", models.CharField(max_length=255)),
|
|
("raw_payload", models.JSONField()),
|
|
("is_verified", models.BooleanField(default=False)),
|
|
("is_processed", models.BooleanField(default=False)),
|
|
("error", models.TextField(blank=True)),
|
|
("received_at", models.DateTimeField(auto_now_add=True)),
|
|
("processed_at", models.DateTimeField(blank=True, null=True)),
|
|
(
|
|
"endpoint",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="events",
|
|
to="infrasynth_webhooks.inboundendpoint",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"db_table": "webhooks_inbound_event",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OutboundSubscription",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("event_name", models.CharField(db_index=True, max_length=255)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("payload_template", models.TextField(blank=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"endpoint",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="subscriptions",
|
|
to="infrasynth_webhooks.outboundendpoint",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"db_table": "webhooks_outbound_subscription",
|
|
"unique_together": {("endpoint", "event_name")},
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OutboundDelivery",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("payload", models.JSONField()),
|
|
("response_status", models.PositiveSmallIntegerField(blank=True, null=True)),
|
|
("response_body", models.TextField(blank=True)),
|
|
("attempt", models.PositiveIntegerField(default=0)),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[("success", "Success"), ("failed", "Failed"), ("retrying", "Retrying")],
|
|
default="retrying",
|
|
max_length=20,
|
|
),
|
|
),
|
|
("next_retry_at", models.DateTimeField(blank=True, null=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("completed_at", models.DateTimeField(blank=True, null=True)),
|
|
(
|
|
"subscription",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="deliveries",
|
|
to="infrasynth_webhooks.outboundsubscription",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"db_table": "webhooks_outbound_delivery",
|
|
},
|
|
),
|
|
]
|