Skip to content
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
4 changes: 2 additions & 2 deletions alert_system/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.26 on 2026-02-03 11:28
# Generated by Django 4.2.26 on 2026-02-09 08:34

from django.conf import settings
import django.contrib.postgres.fields
Expand All @@ -11,7 +11,7 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('api', '0226_nsdinitiativescategory_and_more'),
('api', '0227_alter_eventseveritylevelhistory_options'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('notifications', '0016_alertsubscription'),
]
Expand Down
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 1 files
+9 −0 openapi-schema.yaml
5 changes: 3 additions & 2 deletions notifications/migrations/0016_alertsubscription.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.26 on 2026-01-02 17:07
# Generated by Django 4.2.26 on 2026-02-09 08:32

from django.conf import settings
from django.db import migrations, models
Expand All @@ -8,8 +8,8 @@
class Migration(migrations.Migration):

dependencies = [
('api', '0227_alter_eventseveritylevelhistory_options'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0226_nsdinitiativescategory_and_more'),
('notifications', '0015_rename_molnix_status_surgealert_molnix_status_old'),
]

Expand All @@ -18,6 +18,7 @@ class Migration(migrations.Migration):
name='AlertSubscription',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255, verbose_name='Title of the Subscription')),
('alert_source', models.IntegerField(choices=[(100, 'Montandon')], default=100, verbose_name='Alert Source')),
('alert_per_day', models.IntegerField(blank=True, choices=[(5, 'Five'), (10, 'Ten'), (20, 'Twenty'), (50, 'Fifty')], help_text='Maximum number of alerts sent to the user per day. Leave empty to allow unlimited alerts.', null=True, verbose_name='Alerts Per Day')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
Expand Down
4 changes: 4 additions & 0 deletions notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ class AlertPerDay(models.IntegerChoices):
FIFTY = 50, _("Fifty")
"""Receive up to 50 alerts per day."""

title = models.CharField(
verbose_name=_("Title of the Subscription"),
max_length=255,
)
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
verbose_name=_("User"),
Expand Down
1 change: 1 addition & 0 deletions notifications/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class Meta:
"id",
"user",
"countries",
"title",
"regions",
"hazard_types",
"alert_per_day",
Expand Down
2 changes: 2 additions & 0 deletions notifications/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def setUp(self):
self.hazard_type2 = DisasterTypeFactory.create(name="Earthquake")

self.alert_subscription = AlertSubscriptionFactory.create(
title="Test title",
user=self.user1,
countries=self.countries,
regions=[self.region],
Expand Down Expand Up @@ -280,6 +281,7 @@ def test_list_retrieve_subscription(self):
def test_create_subscription(self):

data = {
"title": "title-1-test",
"user": self.user1.id,
"countries": [self.country.id, self.country_1.id],
"regions": [self.region.id],
Expand Down
Loading