Commit Graph

149 Commits

Author SHA1 Message Date
Kenneth Kehl
874c8ffb54 try batch inserts 2025-01-10 07:58:24 -08:00
Cliff Hill
46ec1aafa8 Getting the IntegrityErrors to be OK if the data already exists in the
DB.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-12-26 08:52:51 -05:00
Kenneth Kehl
14e4d761fc try to fix tests 2024-12-03 13:50:42 -08:00
Kenneth Kehl
146f0cc787 initial 2024-08-15 10:31:02 -07:00
Kenneth Kehl
d7279c7c38 revamp PII masking 2024-06-17 11:12:30 -07:00
Kenneth Kehl
76c34ffae6 Need magic PII-free debugging method for API 2024-06-11 10:34:57 -07:00
Kenneth Kehl
6081ff4873 merge from main 2024-06-06 13:18:00 -07:00
Kenneth Kehl
feb8a1bfaf merge from main 2024-06-06 13:12:37 -07:00
Kenneth Kehl
920d2c4539 debug for notify-admin-1588 2024-06-05 12:42:35 -07:00
Kenneth Kehl
0429a5490d merge from main 2024-06-04 08:29:13 -07:00
Kenneth Kehl
db68583cf9 merge from main 2024-06-04 08:20:01 -07:00
Kenneth Kehl
22ffc56520 remove v2 2024-05-30 12:27:07 -07:00
Kenneth Kehl
905df17f65 remove datetime.utcnow() 2024-05-23 13:59:51 -07:00
Carlo Costino
99edc88197 Localize notification_utils to the API
This changeset pulls in all of the notification_utils code directly into the API and removes it as an external dependency.  We are doing this to cut down on operational maintenance of the project and will begin removing parts of it no longer needed for the API.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2024-05-16 10:17:45 -04:00
Kenneth Kehl
b777249b6f merge from main 2024-03-01 13:50:09 -08:00
Cliff Hill
9523cc1d97 Cleaning up with black, isort, flake8.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:33 -05:00
Cliff Hill
7416de2a28 KeyType implemented.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:33 -05:00
Cliff Hill
69a9accfca Getting NotificationStatus implemented everywhere.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:32 -05:00
Cliff Hill
3982f061b6 Made enums.py for all the enums to avoid cyclic imports.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:31 -05:00
Cliff Hill
43f18eed6a More changes for enums.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:41:57 -05:00
Cliff Hill
820ee5a942 Cleaning up a lot of things, getting Enums used everywhere.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:40:52 -05:00
Kenneth Kehl
31ff6a11ee merge from main 2024-02-01 08:06:10 -08:00
Kenneth Kehl
a790c2f9c7 notify-admin-1158 fix email sending 2024-01-26 11:42:30 -08:00
Kenneth Kehl
b5a0562077 fix tests 2024-01-24 07:55:14 -08:00
Cliff Hill
1157f5639d black, isort, flake8
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2023-12-08 21:43:52 -05:00
Cliff Hill
1fdad3099b Working on tests.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2023-12-08 13:15:40 -05:00
Andrew Shumway
a346a734fc Removed/replaced retention redis count with notification count from db call 2023-11-02 16:16:08 -04:00
stvnrlly
7bbb05059c update to correct error 2023-08-31 10:57:54 -04:00
stvnrlly
bf33ed7173 Merge branch 'main' into notify-300b 2023-08-31 10:28:44 -04:00
Kenneth Kehl
065009bb7a merge from main and reformat 2023-08-29 16:21:18 -07:00
Kenneth Kehl
1ecb747c6d reformat 2023-08-29 14:54:30 -07:00
Kenneth Kehl
5a350560d7 notify-api-433b remove research mode 2023-08-25 12:09:00 -07:00
Kenneth Kehl
00fd3a72bb code review feedback, fix setup.cfg and reformat 2023-08-25 08:10:33 -07:00
Kenneth Kehl
026dc14021 notify-api-412 use black to enforce python style standards 2023-08-23 10:35:43 -07:00
Kenneth Kehl
1765dba476 fix references to gds 2023-08-17 09:01:53 -07:00
Kenneth Kehl
cbed8b8104 retry 2023-07-12 14:52:40 -07:00
Kenneth Kehl
d7ad65ef89 remove autocommit and clean up some bad debug statements 2023-06-27 13:06:38 -07:00
Kenneth Kehl
be04edd04a fix some issues uncovered during testing 2023-05-01 13:26:19 -07:00
Steven Reilly
8d87b6ec09 Add a total-message daily limit (#195) 2023-03-14 16:28:38 -04:00
Steven Reilly
ff4190a8eb Remove letters-related code (#175)
This deletes a big ol' chunk of code related to letters. It's not everything—there are still a few things that might be tied to sms/email—but it's the the heart of letters function. SMS and email function should be untouched by this.

Areas affected:

- Things obviously about letters
- PDF tasks, used for precompiling letters
- Virus scanning, used for those PDFs
- FTP, used to send letters to the printer
- Postage stuff
2023-03-02 20:20:31 -05:00
Ryan Ahearn
bfeb65c914 Install newrelic and enable in development 2023-01-18 09:06:09 -05:00
stvnrlly
e9fdfd59f4 clean flake8 except provider code 2022-10-19 16:16:26 +00:00
Jim Moffet
ac8d8d3c29 clean up config 2022-06-25 18:36:39 -07:00
Rebecca Law
57fb9da414 - change the condition so that we don't reset the cache if it's zero
- set the cache if it doesn't exist so there is an expiry of 24 hours.
2021-06-23 15:09:09 +01:00
Rebecca Law
35b20ba363 Correct the daily limits cache.
Last year we had an issue with the daily limit cache and the query that was populating it. As a result we have not been checking the daily limit properly. This PR should correct all that.

The daily limit cache is not being incremented in app.notifications.process_notifications.persist_notification, this method is and should always be the only method used to create a notification.
We increment the daily limit cache is redis is enabled (and it is always enabled for production) and the key type for the notification is team or normal.

We check if the daily limit is exceed in many places:
 - app.celery.tasks.process_job
 -  app.v2.notifications.post_notifications.post_notification
 - app.v2.notifications.post_notifications.post_precompiled_letter_notification
 - app.service.send_notification.send_one_off_notification
 - app.service.send_notification.send_pdf_letter_notification

If the daily limits cache is not found, set the cache to 0 with an expiry of 24 hours. The daily limit cache key is service_id-yyy-mm-dd-count, so each day a new cache is created.

The best thing about this PR is that the app.service_dao.fetch_todays_total_message_count query has been removed. This query was not performant and had been wrong for ages.
2021-06-22 16:15:36 +01:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Rebecca Law
4a9f9e4b17 Remove the template_postage parameter for persist_notification
It was confusing to have 2 differnt postage parameters.
2020-08-06 07:35:13 +01:00
Rebecca Law
10fe7d9fe8 Add postage for send-one-off letters.
The postage is set to europe or rest-of-world for international letters, otherwise the template postage is used.

Also set international for letters.
2020-08-03 14:01:59 +01:00
Rebecca Law
7fb3b3db18 Small changes to tidy up the code 2020-06-30 09:04:24 +01:00
Rebecca Law
be4b8f0878 Merge branch 'cache-the-serialised-things' of github.com:alphagov/notifications-api 2020-06-26 08:16:48 +01:00