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
3 changes: 2 additions & 1 deletion app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
DELIVERY_STATUS_CALLBACK_TYPE = "delivery_status"
COMPLAINT_CALLBACK_TYPE = "complaint"
SERVICE_CALLBACK_TYPES = [DELIVERY_STATUS_CALLBACK_TYPE, COMPLAINT_CALLBACK_TYPE]
DEFAULT_SMS_DAILY_LIMIT = 1500
DEFAULT_SMS_ANNUAL_LIMIT = 100000
DEFAULT_EMAIL_ANNUAL_LIMIT = 20000000

Expand Down Expand Up @@ -657,7 +658,7 @@ def from_json(cls, data):
fields.pop("letter_logo_filename", None)
fields.pop("letter_contact_block", None)
fields.pop("email_branding", None)
fields["sms_daily_limit"] = fields.get("sms_daily_limit", 100)
fields["sms_daily_limit"] = fields.get("sms_daily_limit", DEFAULT_SMS_DAILY_LIMIT)
fields["email_annual_limit"] = fields.get("email_annual_limit", DEFAULT_EMAIL_ANNUAL_LIMIT)
Comment thread
jzbahrai marked this conversation as resolved.
fields["sms_annual_limit"] = fields.get("sms_annual_limit", DEFAULT_SMS_ANNUAL_LIMIT)

Expand Down
3 changes: 2 additions & 1 deletion app/service/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from app.dao.users_dao import get_user_by_id
from app.errors import CannotRemoveUserError, InvalidRequest, UserAlreadyInServiceError, register_errors
from app.models import (
DEFAULT_SMS_DAILY_LIMIT,
EMAIL_TYPE,
KEY_TYPE_NORMAL,
LETTER_TYPE,
Expand Down Expand Up @@ -243,7 +244,7 @@ def get_service_notification_statistics(service_id):
def create_service():
data = request.get_json()
data["sms_daily_limit"] = data.get(
"sms_daily_limit", 1000
"sms_daily_limit", DEFAULT_SMS_DAILY_LIMIT
) # TODO this is to support current admin. can remove after admin sends an sms_daily_limit

if not data.get("user_id"):
Expand Down
32 changes: 32 additions & 0 deletions migrations/versions/0508_update_daily_sms_limit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Revision ID: 0508_update_daily_sms_limit
Revises: 0507_sms_templates_parts
Create Date: 2026-03-18 00:00:00

Update sms_daily_limit from 1000 to 1500 for all services
that currently have the default limit of 1000.
"""
from alembic import op

revision = "0508_update_daily_sms_limit"
down_revision = "0507_sms_templates_parts"


def upgrade():
op.execute(
"""
UPDATE services
SET sms_daily_limit = 1500
WHERE sms_daily_limit = 1000
"""
)


def downgrade():
op.execute(
"""
UPDATE services
SET sms_daily_limit = 1000
WHERE sms_daily_limit = 1500
"""
)
Comment thread
jzbahrai marked this conversation as resolved.
3 changes: 2 additions & 1 deletion tests/app/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from app.dao.templates_dao import dao_create_template, dao_update_template
from app.dao.users_dao import save_model_user
from app.models import (
DEFAULT_SMS_DAILY_LIMIT,
EMAIL_TYPE,
KEY_TYPE_NORMAL,
LETTER_TYPE,
Expand Down Expand Up @@ -112,7 +113,7 @@ def create_service(
email_from=None,
prefix_sms=True,
message_limit=1000,
sms_daily_limit=1000,
sms_daily_limit=DEFAULT_SMS_DAILY_LIMIT,
email_annual_limit=10000000,
sms_annual_limit=25000,
organisation_type="central",
Expand Down
Loading