Skip to content

Commit 732a30d

Browse files
committed
add help text
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 2b32c29 commit 732a30d

2 files changed

Lines changed: 147 additions & 32 deletions

File tree

notification/migrations/0002_webhooksubscription_webhookdelivery.py

Lines changed: 145 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,166 @@
77

88

99
class Migration(migrations.Migration):
10-
1110
dependencies = [
12-
('dje', '0015_alter_dataspaceconfiguration_purldb_api_key_and_more'),
13-
('notification', '0001_initial'),
11+
("dje", "0015_alter_dataspaceconfiguration_purldb_api_key_and_more"),
12+
("notification", "0001_initial"),
1413
]
1514

1615
operations = [
1716
migrations.CreateModel(
18-
name='WebhookSubscription',
17+
name="WebhookSubscription",
1918
fields=[
20-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21-
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
22-
('target_url', models.URLField(help_text='The URL to which the POST request will be sent when the Webhook is triggered.', max_length=1024, verbose_name='Target URL')),
23-
('is_active', models.BooleanField(default=True, help_text='Indicates whether the Webhook is currently active and should be triggered.')),
24-
('created_date', models.DateTimeField(auto_now_add=True, help_text='The date and time when the Webhook subscription was created.')),
25-
('event', models.CharField(max_length=64)),
26-
('extra_payload', models.JSONField(blank=True, default=dict, help_text='Extra data as JSON to be included in the payload')),
27-
('extra_headers', models.JSONField(blank=True, default=dict, help_text='Extra headers as JSON to be included in the request')),
28-
('dataspace', models.ForeignKey(editable=False, help_text='A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.', on_delete=django.db.models.deletion.PROTECT, to='dje.dataspace')),
19+
(
20+
"id",
21+
models.AutoField(
22+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
23+
),
24+
),
25+
("uuid", models.UUIDField(default=uuid.uuid4, editable=False, verbose_name="UUID")),
26+
(
27+
"target_url",
28+
models.URLField(
29+
help_text="The URL to which the POST request will be sent when the Webhook is triggered.",
30+
max_length=1024,
31+
verbose_name="Target URL",
32+
),
33+
),
34+
(
35+
"is_active",
36+
models.BooleanField(
37+
default=True,
38+
help_text="Indicates whether the Webhook is currently active and should be triggered.",
39+
),
40+
),
41+
(
42+
"created_date",
43+
models.DateTimeField(
44+
auto_now_add=True,
45+
help_text="The date and time when the Webhook subscription was created.",
46+
),
47+
),
48+
(
49+
"event",
50+
models.CharField(
51+
help_text="The event type that triggers this Webhook subscription.",
52+
max_length=64,
53+
verbose_name="Event",
54+
),
55+
),
56+
(
57+
"extra_payload",
58+
models.JSONField(
59+
blank=True,
60+
default=dict,
61+
help_text="Extra data as JSON to be included in the payload",
62+
),
63+
),
64+
(
65+
"extra_headers",
66+
models.JSONField(
67+
blank=True,
68+
default=dict,
69+
help_text="Extra headers as JSON to be included in the request",
70+
),
71+
),
72+
(
73+
"dataspace",
74+
models.ForeignKey(
75+
editable=False,
76+
help_text="A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.",
77+
on_delete=django.db.models.deletion.PROTECT,
78+
to="dje.dataspace",
79+
),
80+
),
2981
],
3082
options={
31-
'ordering': ['-created_date'],
32-
'abstract': False,
33-
'unique_together': {('dataspace', 'uuid')},
83+
"ordering": ["-created_date"],
84+
"abstract": False,
85+
"unique_together": {("dataspace", "uuid")},
3486
},
3587
bases=(dje.models.DataspaceForeignKeyValidationMixin, models.Model),
3688
),
3789
migrations.CreateModel(
38-
name='WebhookDelivery',
90+
name="WebhookDelivery",
3991
fields=[
40-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
41-
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
42-
('target_url', models.URLField(help_text='Stores a copy of the Webhook target URL in case the subscription object is deleted.', max_length=1024, verbose_name='Target URL')),
43-
('sent_date', models.DateTimeField(auto_now_add=True, help_text='The date and time when the Webhook was sent.')),
44-
('payload', models.JSONField(blank=True, default=dict, help_text='The JSON payload that was sent to the target URL.')),
45-
('response_status_code', models.PositiveIntegerField(blank=True, help_text='The HTTP status code received in response to the Webhook request.', null=True)),
46-
('response_text', models.TextField(blank=True, help_text='The text response received from the target URL.')),
47-
('delivery_error', models.TextField(blank=True, help_text='Any error messages encountered during the Webhook delivery.')),
48-
('dataspace', models.ForeignKey(editable=False, help_text='A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.', on_delete=django.db.models.deletion.PROTECT, to='dje.dataspace')),
49-
('webhook_subscription', models.ForeignKey(blank=True, editable=False, help_text='The Webhook subscription associated with this delivery.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='deliveries', to='notification.webhooksubscription')),
92+
(
93+
"id",
94+
models.AutoField(
95+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
96+
),
97+
),
98+
("uuid", models.UUIDField(default=uuid.uuid4, editable=False, verbose_name="UUID")),
99+
(
100+
"target_url",
101+
models.URLField(
102+
help_text="Stores a copy of the Webhook target URL in case the subscription object is deleted.",
103+
max_length=1024,
104+
verbose_name="Target URL",
105+
),
106+
),
107+
(
108+
"sent_date",
109+
models.DateTimeField(
110+
auto_now_add=True, help_text="The date and time when the Webhook was sent."
111+
),
112+
),
113+
(
114+
"payload",
115+
models.JSONField(
116+
blank=True,
117+
default=dict,
118+
help_text="The JSON payload that was sent to the target URL.",
119+
),
120+
),
121+
(
122+
"response_status_code",
123+
models.PositiveIntegerField(
124+
blank=True,
125+
help_text="The HTTP status code received in response to the Webhook request.",
126+
null=True,
127+
),
128+
),
129+
(
130+
"response_text",
131+
models.TextField(
132+
blank=True, help_text="The text response received from the target URL."
133+
),
134+
),
135+
(
136+
"delivery_error",
137+
models.TextField(
138+
blank=True,
139+
help_text="Any error messages encountered during the Webhook delivery.",
140+
),
141+
),
142+
(
143+
"dataspace",
144+
models.ForeignKey(
145+
editable=False,
146+
help_text="A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.",
147+
on_delete=django.db.models.deletion.PROTECT,
148+
to="dje.dataspace",
149+
),
150+
),
151+
(
152+
"webhook_subscription",
153+
models.ForeignKey(
154+
blank=True,
155+
editable=False,
156+
help_text="The Webhook subscription associated with this delivery.",
157+
null=True,
158+
on_delete=django.db.models.deletion.SET_NULL,
159+
related_name="deliveries",
160+
to="notification.webhooksubscription",
161+
),
162+
),
50163
],
51164
options={
52-
'verbose_name': 'webhook delivery',
53-
'verbose_name_plural': 'webhook deliveries',
54-
'ordering': ['-sent_date'],
55-
'abstract': False,
56-
'unique_together': {('dataspace', 'uuid')},
165+
"verbose_name": "webhook delivery",
166+
"verbose_name_plural": "webhook deliveries",
167+
"ordering": ["-sent_date"],
168+
"abstract": False,
169+
"unique_together": {("dataspace", "uuid")},
57170
},
58171
bases=(dje.models.DataspaceForeignKeyValidationMixin, models.Model),
59172
),

notification/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class WebhookSubscription(DataspacedModel, AbstractWebhookSubscription):
3535
"""
3636

3737
event = models.CharField(
38+
_("Event"),
3839
max_length=64,
40+
help_text=_("The event type that triggers this Webhook subscription."),
3941
)
4042
extra_payload = models.JSONField(
4143
blank=True,

0 commit comments

Comments
 (0)