Commit Graph

192 Commits

Author SHA1 Message Date
Kenneth Kehl
abd1898150 fix code for vulture 2023-08-08 11:48:19 -07:00
Kenneth Kehl
4940d5e93b notify-api-332 rename organisation 2023-07-10 11:06:29 -07:00
Kenneth Kehl
39707adf10 Merge branch 'main' of https://github.com/GSA/notifications-api into notify-260 2023-05-30 11:47:36 -07:00
Kenneth Kehl
6f6061455c notify-162 delete incomplete s3 uploads (#276)
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
2023-05-23 11:31:30 -04:00
Kenneth Kehl
08c1ad75c8 notify-260 remove server-side timezone handling 2023-05-10 08:39:50 -07:00
Kenneth Kehl
001954538e notify-243 remove statsd 2023-04-25 07:50:56 -07:00
Kenneth Kehl
27d86c949a #224 remove crown (#228)
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
2023-04-11 16:29:37 -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
Steven Reilly
dc06b411ca Update default templates and add update command (#166)
This commit adds config_files for default data and, using that, creates a new way to update our default templates without needing to hardcode a migration.

---------

Co-authored-by: Ryan Ahearn <ryan.ahearn@gsa.gov>
2023-02-03 10:11:21 -05:00
Ryan Ahearn
041cd08097 Clean up more mmg and firetext references 2022-12-22 09:31:12 -05:00
Ryan Ahearn
0ed7a31765 Merge pull request #126 from GSA/open-api
Add OpenAPI spec for selected api endpoints
2022-11-30 13:30:26 -05:00
Ryan Ahearn
1e7d99e853 Fix flake8 and isort findings 2022-11-18 12:39:50 -05:00
Ryan Ahearn
2efed403b1 Add external API for sending SMS to openapi 2022-11-18 12:25:45 -05:00
Ryan Ahearn
3b7dbddc58 Add /user routes to openapi schema 2022-11-17 10:57:34 -05:00
stvnrlly
b50cb4712f tz utility swap and many test updates 2022-11-10 12:33:25 -05:00
stvnrlly
57adbf3f6b document create-test-user command 2022-11-01 12:14:26 -04:00
stvnrlly
713daee566 flake8 indentation 2022-10-28 14:49:02 -04:00
stvnrlly
11d123051a validate mobile number so that sms auth works 2022-10-28 14:42:25 -04:00
stvnrlly
19cdd9b052 tests & prompts for user creation command 2022-10-28 14:07:43 -04:00
stvnrlly
4eeba59abb Merge branch 'main' into stvnrlly-create-user-command 2022-10-28 13:37:30 -04:00
stvnrlly
d87c224473 remove broadcast-related code, except migrations 2022-10-26 16:41:35 -04:00
Steven Reilly
d37c2a53b8 Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-25 10:17:49 -04:00
stvnrlly
d4e156e8ae Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-20 19:44:20 -04:00
stvnrlly
2ce19fd502 add env check before purging data in command 2022-10-20 14:04:38 -04:00
stvnrlly
e9fdfd59f4 clean flake8 except provider code 2022-10-19 16:16:26 +00:00
stvnrlly
0186095920 swap out uk org types for us-specific org types 2022-10-11 20:27:49 +00:00
stvnrlly
53204c307b tests are, uh, mostly passing 2022-10-05 01:12:35 +00:00
stvnrlly
57f4df8ed1 remove broadcast-related code, except migrations 2022-10-04 15:28:27 +00:00
stvnrlly
50938a7979 deactivate some deprecated or unnecessary commands 2022-10-03 19:53:46 +00:00
stvnrlly
0cf6661ea6 add command for creating users in local dev 2022-10-03 19:51:24 +00:00
Ryan Ahearn
3c035531aa Clean up and validate low static-scan findings 2022-08-19 14:32:11 +00:00
Ryan Ahearn
53f2519c2a Verify potential sql-injection findings are false positives 2022-08-18 19:07:54 +00:00
Leo Hemsted
51646af92e remove provider_rates table
this was added five years ago but never used. if we want to bring back
variable rates per client we might as well get a fresh start since a lot
has changed since then.
2022-05-03 14:42:59 +01:00
Ben Thorner
13245f74d4 Merge pull request #3491 from alphagov/fix-broadcast-perm-command
Fix missing permission for dev broadcast users
2022-03-28 14:03:54 +01:00
Ben Thorner
3b519a2188 Fix missing permission for dev broadcast users
This is normally added automatically [^1].

[^1]: b145a29935/app/dao/broadcast_service_dao.py (L69)
2022-03-24 12:36:23 +00:00
Rebecca Law
926eb5b48f Update app.commands.populate_annual_billing_with_defaults so that if the
service has zero free allowance in the previous year, set this year to
zero as well.
2022-03-22 10:02:32 +00:00
Katie Smith
67d1b3719e Stop blank strings being inserted as inbound numbers
We had an inbound number in the database with a value of ''. This
could happen if there are blank lines in the inbound numbers file
we use for the `insert-inbound-numbers` command. To avoid this
happening again, the command now calls `.strip()` on each line of the
file and only inserts a row if the result is truthy (i.e. not '').
2022-03-01 15:31:54 +00:00
Ben Thorner
c3da139e9c Remove redundant migration tasks (esp. for status)
These were added long ago [1][2] and aren't referenced in runbooks,
so it should be safe to delete them.

[1]: 13f3662051
[2]: b9953dd005
2022-01-12 15:47:58 +00:00
Ben Thorner
a8edfeb941 Remove command to replay callbacks
In response to [1].

I've already removed the runbook that referred to this.

[1]: https://github.com/alphagov/notifications-api/pull/3383#discussion_r765644576
2021-12-09 10:46:19 +00:00
Ben Thorner
04da017558 DRY-up conditionally creating callback tasks
This removes 3 duplicate instances of the same code, which is still
tested implicitly via test_process_ses_receipt_tasks [1]. In the
next commit we'll make this test more explicit, to reflect that it's
now being reused elsewhere and shouldn't change arbitrarily.

We do lose the "print" statement from the command instance of the
code, but I think that's a very tolerable loss.

[1]: 16ec8ccb8a/tests/app/celery/test_process_ses_receipts_tasks.py (L94)
2021-12-06 14:11:34 +00:00
Ben Thorner
2acc4ee67d Repurpose command to replay notification callbacks
This is so we can use it to address issues highlighted by the new
alert, if it's not possible to actually send the notifications e.g.
if they are somehow 'invalid'.

Previously this was added for a one-off use case [1]. This rewrites
the task to operate on arbitrary notification IDs instead of client
refs, which aren't always present for notifications we may want to
send / replay callbacks for. Since the task may now need to work on
notifications more than one service, I had to restructure it to cope
with multiple callback APIs.

Note that, in the test, I've chosen to do a chain of invocations and
assertions, rather than duplicate a load of boilerplate or introduce
funky parametrize flags for a service with/out a callback API. We'll
refactor this in a later commit.

[1]: e95740a6b5
2021-12-06 14:00:35 +00:00
Katie Smith
250ce38cf2 Remove unecessary list-routes command
Since this was added, Flask now comes with a build in command to list
the routes, `flask routes`, so this is not needed.
2021-11-30 11:11:49 +00:00
Katie Smith
6d9f2c27d9 Add command to populate organisation table with agreement details
When we first started recording the details of the agreements that
were signed by organisations, we stored a copy of the signed agreement
in Google drive. Later, we switched to storing the details in the
database instead.

This adds a command which is designed to be run once and which updates
the database for the organisations which had the details of who accepted
the agreement and when stored in Google drive.
2021-11-30 11:11:49 +00:00
Katie Smith
3cffba6d09 Add command to run recreate_pdf_for_precompiled_or_uploaded_letter
We already had the `replay-create-pdf-for-templated-letter` command.
This adds a new command,
`recreate-pdf-for-precompiled-or-uploaded-letter` which does the same
thing but for non-templated letters.
2021-11-10 09:51:31 +00:00
Katie Smith
ec9c3cac5f Rename replay_create_pdf_letters command
This changes the name to make it clearer that this command is for
templated letters only, and not for PDF letters.
2021-11-10 09:51:31 +00:00
Ben Thorner
7d631960eb Fix incorrect ordering in command wrapper
Previously this was causing the wrapper function to become a
command before it started mirroring the original (functools.wraps),
which meant any previous option decorators were "lost".*

We didn't notice the problem in the original PR [1] because the new
command under test has its option decorators *after* the command
decorator, in contrast with all other (now broken) commands.

The original wrapper applied the functools decorator first [2],
so this change just reinstates that ordering.

*This is a hand-wavey explanation as I haven't looked into how
functools.wraps interacts with option decorators.

[1]: 922fd2f333#
[2]: 922fd2f333 (diff-c4e75c8613e916687a97191a7a79110dfb47e96ef7df96f7ba25dd94ba64943dL101)
2021-10-08 14:21:59 +01:00
Ben Thorner
922fd2f333 Support testing commands and add first test
We have a lot of commands and it's important we test the ones that
are meant to be used in the future to ensure they work when they're
needed. Testing Flask commands is usually easy as written in their
docs [1], but I had to make some changes to the way we decorate the
command functions so they can work with test DB objects - I couldn't
find any example of someone else encountering the same problem.

[1]: https://flask.palletsprojects.com/en/2.0.x/testing/#testing-cli-commands
2021-09-14 09:29:23 +01:00
Ben Thorner
04d8678c27 Make it easy to develop with broadcast services
Previously I had to handcraft some SQL to give myself access to a
broadcast service I created locally. I've done this enough times
that I think it's worth automating.
2021-09-08 09:45:11 +01:00
Ben Thorner
406e7e9aa1 Remove redundant command to migrate area data
The migration has been done.
2021-09-07 13:32:01 +01:00
Ben Thorner
b639031b9f Add command to migrate custom broadcast areas
Unlike broadcasts created in the Admin app, these are only expected
to have "names" and "simple_polygons" in their areas column [1].

The migration command in the Admin app [2] isn't suitable for these
broadcasts as it would try to aggregate their areas, etc.

I've put a conditional on "areas" being present (in the areas column)
so this command doesn't pick up any new custom broadcasts.

[1]: 023a06d5fbo
[2]: https://github.com/alphagov/notifications-admin/pull/4011
2021-09-06 18:15:32 +01:00