Commit Graph

474 Commits

Author SHA1 Message Date
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
ac9591ec7c More tweaks, trying to get tests to be clean.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:31 -05:00
Cliff Hill
908d695b54 More cleanup.
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
510e67e20b code review feedback 2024-01-18 15:12:52 -08:00
Kenneth Kehl
f9120e7d3e optimize how we look up phone numbers 2024-01-18 13:54:23 -08:00
Kenneth Kehl
c13ed73d23 substitute phone numbers back in when sending data to reports 2024-01-17 09:04:04 -08:00
Carlo Costino
5ae2335c82 Update failing test; include blackened files
Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-12-06 11:11:00 -05:00
Carlo Costino
f72922ffb1 Remove unused variable
This changeset follows up PR #636 to remove a variable no longer used in the go live email template.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-12-06 10:13:27 -05:00
Andrew Shumway
d0368695db Revert "Added flag to remove default sender from user list" 2023-11-06 11:49:17 -07:00
Andrew Shumway
9444310d4b Fix linting/imports 2023-11-02 16:21:02 -04:00
Andrew Shumway
32dca0f5e0 Add notification history and notification to count 2023-11-02 16:21:02 -04:00
Andrew Shumway
db7aa969cd Added api endpoint for count 2023-11-02 16:21:00 -04:00
Andrew Shumway
c247891c97 Add initial steps to call api for count 2023-11-02 16:18:02 -04:00
Andrew Shumway
0dd862f936 Revert removal of unneeded code 2023-11-02 16:18:01 -04:00
Andrew Shumway
a346a734fc Removed/replaced retention redis count with notification count from db call 2023-11-02 16:16:08 -04:00
Andrew Shumway
c5e1452419 Update app/service/rest.py
Co-authored-by: Carlo Costino <ccostino@users.noreply.github.com>
2023-10-17 13:49:12 -06:00
Andrew Shumway
c7f11133d3 Added another flag in appropriate test 2023-10-16 15:02:52 -06:00
Andrew Shumway
e0522393df Added flag to remove default sender from user list 2023-10-15 16:28:25 -06:00
stvnrlly
8bfc64ebf9 insert total_message_limit into service creation 2023-09-06 12:26:37 -04:00
stvnrlly
bf33ed7173 Merge branch 'main' into notify-300b 2023-08-31 10:28:44 -04: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
6fa4c05adf fix flake8 2023-07-21 10:42:17 -07:00
Kenneth Kehl
cbed8b8104 retry 2023-07-12 14:52:40 -07:00
Kenneth Kehl
4940d5e93b notify-api-332 rename organisation 2023-07-10 11:06:29 -07:00
Kenneth Kehl
37e790f19f merge from main 2023-06-19 07:56:10 -07:00
Kenneth Kehl
e4a98dfcc2 cleanup, get rid of print statements, etc. 2023-06-15 10:45:03 -07:00
Kenneth Kehl
8db16f9410 fix tests 2023-06-15 08:23:00 -07:00
Kenneth Kehl
9f9e0a6ad8 notify-136 change financial year starting in april to calendar year (#278)
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
2023-06-14 16:19:11 -04:00
Kenneth Kehl
e7196afde1 fix the inline display for Failed on the dashboard 2023-06-14 07:37:38 -07:00
Kenneth Kehl
008c3a8d68 initial 2023-06-13 12:57:51 -07:00
Kenneth Kehl
db0d829238 notify-281 fix time-sensitive tests 2023-05-31 17:52:16 -07:00
Kenneth Kehl
08c1ad75c8 notify-260 remove server-side timezone handling 2023-05-10 08:39:50 -07:00
Kenneth Kehl
0dce30bf5e cleanup 2023-05-01 13:41:48 -07:00
Kenneth Kehl
be04edd04a fix some issues uncovered during testing 2023-05-01 13:26:19 -07:00
Kenneth Kehl
9de806000a notify-300 set total message limit of 250k 2023-04-28 12:37:06 -07:00
Ryan Ahearn
e07b596857 Remove contact list db, dao, and s3 code 2023-04-12 15:01:24 -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
stvnrlly
213f699c99 time adjustments in tests 2022-11-14 14:23:54 -05:00
stvnrlly
b50cb4712f tz utility swap and many test updates 2022-11-10 12:33:25 -05:00
stvnrlly
57f4df8ed1 remove broadcast-related code, except migrations 2022-10-04 15:28:27 +00:00
Katie Smith
8ae2b0bb31 Replace how .dump is called
As with `.load`, only data is now returned instead of a tuple.
2022-05-25 11:35:44 +01:00
Katie Smith
bd4f74b359 Replace how .load is called
https://marshmallow.readthedocs.io/en/stable/upgrading.html#schemas-are-always-strict

`.load` doesn't return a `(data, errors)` tuple any more - only data is
returned. A `ValidationError` is raised if validation fails. The code
now relies on the `marshmallow_validation_error` error handler to handle
errors instead of having to raise an `InvalidRequest`. This has no
effect on the response that is returned (a test has been modified to
check).

Also added a new `password` field to the `UserSchema` so that we don't
have to specially check for password errors in the `.create_user` endpoint
- we can let marshmallow handle them.
2022-05-25 11:35:44 +01:00
Katie Smith
b440f3f904 Use Draft-07 and Draft7Validator everywhere
We were using the Draft4Validator in one place, so this updates it to
the Draft7Validator instead.

The schemas were mostly using draft 4 of the JSON schema, though there
were a couple of schemas that were already of version 7. This updates
them all to version 7, which is the latest version fully supported by
the jsonschema Python package. There are some breaking changes in the
newer version of the schema, but I could not see anywhere would these
affect us. Some of these schemas were not valid in version 4, but are
now valid in version 7 because `"required": []` was not valid in earlier
versions.
2022-04-14 14:46:10 +01:00
Ben Thorner
413c6c4c26 Move check for existing letter earlier in endpoint
In response to: [^1].

[^1]: https://github.com/alphagov/notifications-api/pull/3503#discussion_r848426047
2022-04-12 15:51:06 +01:00
Ben Thorner
5810d46d35 Don't error sending a letter that's sent already
Fixes this error (in Admin):

      File "/home/vcap/app/app/notify_client/notification_api_client.py", line 74, in send_precompiled_letter
        return self.post(url='/service/{}/send-pdf-letter'.format(service_id), data=data)
      File "/home/vcap/app/app/notify_client/__init__.py", line 59, in post
        return super().post(*args, **kwargs)
      File "/home/vcap/deps/0/python/lib/python3.9/site-packages/notifications_python_client/base.py", line 48, in post
        return self.request("POST", url, data=data)
      File "/home/vcap/deps/0/python/lib/python3.9/site-packages/notifications_python_client/base.py", line 64, in request
        response = self._perform_request(method, url, kwargs)
      File "/home/vcap/deps/0/python/lib/python3.9/site-packages/notifications_python_client/base.py", line 118, in _perform_request
        raise api_error
    notifications_python_client.errors.HTTPError: 500 - Internal server error

Due to this error (in API):

      File "/home/vcap/app/app/service/send_notification.py", line 178, in send_pdf_letter_notification
        raise e
      File "/home/vcap/app/app/service/send_notification.py", line 173, in send_pdf_letter_notification
        letter = utils_s3download(current_app.config['TRANSIENT_UPLOADED_LETTERS'], file_location)
      File "/home/vcap/deps/0/python/lib/python3.9/site-packages/notifications_utils/s3.py", line 53, in s3download
        raise S3ObjectNotFound(error.response, error.operation_name)
    notifications_utils.s3.S3ObjectNotFound: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.

I checked the DB to verify the letter does actually exist i.e. it
is an instance of the problem we're fixing here.
2022-04-08 17:20:44 +01:00
Chris Hill-Scott
a4347a5165 Remove endpoints for checking name uniqueness
The code which called these endpoints was removed:
- for services in https://github.com/alphagov/notifications-admin/pull/4084/files
- for organisations in https://github.com/alphagov/notifications-admin/pull/4128/files

Therefore these endpoints are no longer needed.
2022-01-13 17:12:40 +00:00
Katie Smith
0b7410818e Allow get_all_notifications_for_service to accept POST requests
We want admin to send a POST request to this route if the data contains
a message recipient (a phone number or email address) so that this does
not show in the logs. This changes the route to accept both GET and POST
requests.
2022-01-04 14:04:03 +00:00