Commit Graph
93 Commits
Author SHA1 Message Date
Andrew Shumway e956ca5017 Add more debug 2024-07-23 13:37:52 -06:00
Kenneth Kehl 23335bb4a9 fix personalization on job/service/notification api 2024-04-05 11:38:00 -07:00
Andrew Shumway d3b895ddc6 PEP-257 changes 2024-03-27 10:32:40 -06:00
Andrew Shumway 6599c284cc Add docs/code comments for message-send-flow 2024-03-18 11:45:40 -06:00
Andrew Shumway 5f2508a975 Add docs/code comments for message send flow 2024-03-18 11:32:29 -06:00
Kenneth Kehl ec9619c43f merge from main 2024-03-05 11:09:08 -08:00
Carlo Costino 3db6462a82 Merge pull request #822 from GSA/notify-admin-1148
make sure original_file_name is stored as part of job (notify-admin-1…
2024-03-04 14:21:36 -05:00
Kenneth Kehl b777249b6f merge from main 2024-03-01 13:50:09 -08:00
Cliff Hill 11992be740 Fixing things is fun.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 15:54:35 -05:00
Cliff Hill a8cf49e995 Fixed another error.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:58:24 -05: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 db3761609b Job Status changed.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:33 -05:00
Kenneth Kehl 689d82280b fix tests 2024-02-28 08:23:56 -08:00
Kenneth Kehl 6d4064e888 make sure original_file_name is stored as part of job (notify-admin-1148) 2024-02-28 07:41:13 -08:00
Kenneth Kehl ed3a356ad1 merge from main and fix some tests 2024-01-19 08:58:24 -08:00
Kenneth Kehl 567dd390b4 fix personalisation 2024-01-18 10:03:35 -08:00
Kenneth Kehl c13ed73d23 substitute phone numbers back in when sending data to reports 2024-01-17 09:04:04 -08: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
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
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
Ben Thorner a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Chris Hill-Scott 2fcde009ac Add an endpoint for stats about scheduled jobs
At the moment we display the count of scheduled jobs on the dashboard
by sending all the scheduled jobs to the admin app and letting it work
out the stats.

This is inefficient and, because the get jobs response has a page size
of 50, becomes incorrect if a service schedules more than 50 jobs.

This commit adds a separate endpoint which gives the admin app the stats
it needs directly and correctly.
2020-09-28 09:57:32 +01:00
Chris Hill-Scott 18ffccf8c9 Allow jobs to be filtered by contact list
Rather than showing all jobs that have been ‘copied’ from a contact list
I think it makes more sense to group them under the contact list. This
way it’s easier to see what messages have been sent to a given group of
contacts over time.

Part of this work means the API needs to return only jobs that have been
created from a given contact list, when asked.
2020-05-12 12:58:39 +01:00
Chris Hill-Scott 27a0ba1a65 Reformat arguments for readability
We want to add another argument here, and doing so would make the line
length too long with all the arguments on one line.

Also uses the * operator to enforce keyword-only arguments.
2020-05-12 12:57:54 +01:00
Rebecca Law 8545b097f9 [WIP] 2020-03-16 16:45:34 +00:00
Rebecca Law 7fc7d99dac Update the new endpoint to return a 404 if the job or service id are not found.
All our endpoint should perform a check that the params are valid - this is an easy whay to check that and is standard for our endpoints.
I reverted the query to just filter by job id.
2019-10-03 14:58:49 +01:00
Pea Tyczynska c48aa77dd5 Use service_id in the query to make it safer, also use named parameters 2019-09-25 16:32:27 +01:00
Pea Tyczynska 8cf8d24e37 Return count of notifications in the database for a job
When we cancel a job, we need to check if all notifications are
already in the database. So far, we were querying for all
notification objects in the database and counting them in
admin app, which runs into pagination problems for large jobs,
and could time out for very large jobs.
2019-09-24 16:56:03 +01:00
Pea Tyczynska 2c79801c96 Return tuple from can_cancel_letter_job for clarity 2019-07-02 18:12:48 +01:00
Pea Tyczynska da65ba0c91 Return specific error messages if job cannot be cancelled
Also move checking if job can be cancelled to the endpoint
2019-07-01 15:44:39 +01:00
Rebecca Law 663b260777 Adding a cancel-letter-job endpoint to cancel a letter job. 2019-06-28 15:57:39 +01:00
Rebecca Law 6565c19a9b Adding new method to cancel a letter job. 2019-06-28 15:57:39 +01:00
Leo Hemsted 251aecab1b base job start of processing_started rather than created_at
otherwise scheduled jobs will be viewed as old, and we'll pull stats
from the statistics tables, even if they might have not even started
yet
2018-12-17 15:47:16 +00:00
Leo Hemsted b80beab76c use ft_notification_status and notifications for job statistics
we previously always read from NotificationHistory to get the
notification status stats for a job. Now, if the job is more than three
days old read from ft_notification_status table, otherwise read from
the notifications table (to keep live updates).
2018-12-12 13:27:19 +00:00
Katie Smith d20e35d075 Get and use sender_id from S3 metadata
The `save_email` and `save_sms` jobs were updated previously to take an
optional `sender_id` and to use this if it was available. This commit
now gets the `sender_id` from the S3 metadata if it exists and passes it
through the the tasks which save the job notifications. This means SMS
and emails sent through jobs can use a specified `sender_id` instead of
the default.
2018-11-12 10:59:48 +00:00
Chris Hill-Scott 84024a9efc Refuse to process invalid files
Since the admin app won’t be checking the metadata when it starts a job
now it’s possible that someone could make a post request which attempts
to start a job for an invalid file. This commit adds a check to make
sure that can’t happen.

This is more of an extra safety thing, rather than something that the
admin app or a user will see.
2018-04-30 11:47:27 +01:00
Chris Hill-Scott a4857c08ab Read job metadata from S3 metadata
All of our uploads now have the metadata about the job set on them in
S3. So this commit moves to using that metadata, if it’s there, instead
of the data in the body of the post request.

The aim of this is to stop the admin app having to post this data, which
means that it won’t have to keep this data in the session for the
while doing the file upload flow.
2018-04-30 11:47:13 +01:00
Katie Smith 44c4026df2 Delete job-stats endpoints
Deleted these endpoints:
* /service/<uuid:service_id>/job-stats/<job_id>
* /service/<uuid:service_id>/job-stats
2018-03-12 10:48:46 +00:00
Leo Hemsted 28d5f9b87f flake8 - remove unused imports and ensure they're always at the top of the file 2017-11-28 14:28:01 +00:00
Ken Tsang ff860ec242 403 when creating a letter job in trial mode 2017-08-30 16:04:10 +01:00
Leo Hemsted 6c61a3fc2a Revert celery4
Revert the following three pull requests:
https://github.com/alphagov/notifications-api/pull/1085
https://github.com/alphagov/notifications-api/pull/1086
https://github.com/alphagov/notifications-api/pull/1088

celery 4.0.2 looked promising, however, on staging under mild load
(5/sec api calls) the performance was actually worse than 3.1.25
2017-07-19 15:17:19 +01:00
Martyn Inglis 786adb5d71 Move Queuenames in with the celery code, revamp config to allow move to celery 4.x 2017-07-12 12:01:52 +01:00
Rebecca Law 4fefec6aa3 New endpoints to return job stats.
Next step is to use the new endpoints in admin.
2017-06-13 10:56:03 +01:00
Rebecca Law cc04b5eb1d Added new endpoint for job statistics.
The structure has been flattened, so I need to create a new endpoint, start using that endpoint, then change the name back.
Added template_id and version to the get job stats by id.
2017-06-12 17:15:32 +01:00
Martyn Inglis 2591d3a1df This massive set of changes uses the new queue names object throughout the app and tests.
Lots of changes, all changing the line of code that puts things into queues, and the code that tests that.
2017-05-25 10:51:49 +01:00
Imdad Ahad 49fb4823e3 Refactor tests 2017-04-21 11:07:45 +01:00
Imdad Ahad 4dfd5448ad Make get all notications return in csv format too:
* This adds functionality (via an extra req param) to the
* existing get all notifications method allowing us to specify
* when we want the API to return in csv/non-csv format
2017-04-20 12:31:49 +01:00