From 516268775ee0581a791fb4fd6244126792f579ba Mon Sep 17 00:00:00 2001 From: Zach Aysan Date: Thu, 27 Jun 2024 09:04:40 -0400 Subject: [PATCH] feat: Update API usage notifications thresholds (#4255) --- api/organisations/constants.py | 2 +- .../migrations/0055_alter_percent_usage.py | 19 +++++++++++++++++++ api/organisations/models.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 api/organisations/migrations/0055_alter_percent_usage.py diff --git a/api/organisations/constants.py b/api/organisations/constants.py index 26e9c93a2a9a..4cbdff0ba3fb 100644 --- a/api/organisations/constants.py +++ b/api/organisations/constants.py @@ -1,4 +1,4 @@ -API_USAGE_ALERT_THRESHOLDS = [75, 90, 100, 120] +API_USAGE_ALERT_THRESHOLDS = [75, 90, 100, 120, 200, 300, 400, 500] API_USAGE_GRACE_PERIOD = 7 ALERT_EMAIL_MESSAGE = ( "Organisation %s has used %d seats which is over their plan limit of %d (plan: %s)" diff --git a/api/organisations/migrations/0055_alter_percent_usage.py b/api/organisations/migrations/0055_alter_percent_usage.py new file mode 100644 index 000000000000..96e0d3008742 --- /dev/null +++ b/api/organisations/migrations/0055_alter_percent_usage.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.25 on 2024-06-26 18:11 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('organisations', '0054_create_api_billing'), + ] + + operations = [ + migrations.AlterField( + model_name='organisationapiusagenotification', + name='percent_usage', + field=models.IntegerField(validators=[django.core.validators.MinValueValidator(75), django.core.validators.MaxValueValidator(500)]), + ), + ] diff --git a/api/organisations/models.py b/api/organisations/models.py index 436a9b512da4..9a421ca5467d 100644 --- a/api/organisations/models.py +++ b/api/organisations/models.py @@ -468,7 +468,7 @@ class OrganisationAPIUsageNotification(models.Model): ) percent_usage = models.IntegerField( null=False, - validators=[MinValueValidator(75), MaxValueValidator(120)], + validators=[MinValueValidator(75), MaxValueValidator(500)], ) notified_at = models.DateTimeField(null=True)