cds-snc / notification-api

GC Notify API | GC Notification API
https://notification.canada.ca
MIT License
51 stars 18 forks source link

Add a table to store annual_limits data #2339

Closed jzbahrai closed 1 week ago

jzbahrai commented 1 week ago

Summary | Résumé

Add a table to store data on usage for annual limits per service. This will be used to send a quarterly email to all service owners about their usage.

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

Ran flask upgrade locally and you will see the new table

notification_api=# \d annual_limits_data
                    Table "public.annual_limits_data"
       Column       |       Type        | Collation | Nullable | Default 
--------------------+-------------------+-----------+----------+---------
 service_id         | uuid              |           | not null | 
 time_period        | character varying |           | not null | 
 annual_email_limit | bigint            |           | not null | 
 annual_sms_limit   | bigint            |           | not null | 
 notification_type  | character varying |           | not null | 
 notification_count | bigint            |           | not null | 
Indexes:
    "ix_service_id_notification_type" btree (service_id, notification_type)
Foreign-key constraints:
    "fk_service_id" FOREIGN KEY (service_id) REFERENCES services(id)

Reviewer checklist | Liste de vérification du réviseur

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.