Commit Graph

95 Commits

Author SHA1 Message Date
Rebecca Law
39c9d9ebe9 Merge branch 'master' into refactor-query-filters
Conflicts:
	app/permission/rest.py
2016-06-16 10:26:17 +01:00
Rebecca Law
f8262b13c1 Refactor permissions dao - removed custom query filter
Removed permissions rest - not being used.
2016-06-15 16:32:52 +01:00
Adam Shimali
b33312b855 Change endpoint responses where there are marshalling, unmarshalling
or param errors to raise invalid data exception. That will cause
those responses to be handled in by errors.py, which will log
the errors.

Set most of schemas to strict mode so that marshmallow will raise
exception rather than checking for errors in return tuple from load.

Added handler to errors.py for marshmallow validation errors.
2016-06-15 14:37:51 +01:00
Leo Hemsted
7083be429a exclude notifications from job
was being lazily loaded to get notification ids, so every time a job is loaded it would potentially select thousands of notifications from the database
2016-06-10 15:37:05 +01:00
Leo Hemsted
7801efd5ca don't create job if template has been archived 2016-05-24 13:08:02 +01:00
Leo Hemsted
81e5eb2c0a return all zeros when NotificationStatistics dont exist 2016-05-20 15:24:57 +01:00
Nicholas Staples
1797d9360b Update template json to return created_at and updated_at. Also fixed a bug where updated_at was not being added to the templates_history model. 2016-05-19 17:02:55 +01:00
Rebecca Law
992f9d78f9 There is a problem where columns on the templates table were not set.
It is also discovered that columns that have a default value and use the version mixin must set the value when creating the db object before the insert otherwise the history table will be missing the default value.
Updated the templates_history.created_by_id with a value where missing, using the current version of the template for this value.
Update templates_history.archived to false. This is okay as we do not yet have a way to set this value to true.
Removed the versions attribute from the TemplateSchema, there is not a need for this column.
2016-05-16 16:16:14 +01:00
Martyn Inglis
09b3313ce3 Merge branch 'master' into primary-provider
Conflicts:
	tests/app/dao/test_provider_rates_dao.py
2016-05-11 14:04:15 +01:00
Rebecca Law
eb9f47af68 Merge branch 'master' into add-user-to-job 2016-05-11 12:08:39 +01:00
Rebecca Law
aff0abb78c Add a load only and dump only for the created_by attribute of the JobSchema 2016-05-11 12:03:25 +01:00
Nicholas Staples
083d3d75ae Add user details to template schema dump. 2016-05-10 14:55:59 +01:00
Martyn Inglis
8669a169eb Merge branch 'master' into primary-provider
Conflicts:
	app/dao/notifications_dao.py
	app/dao/provider_statistics_dao.py
	app/schemas.py
	tests/app/conftest.py
2016-05-10 09:13:02 +01:00
Martyn Inglis
571686b638 Ensure that the primary provider is used in all tasks 2016-05-10 09:04:22 +01:00
NIcholas Staples
f06aaa924e Merge pull request #287 from alphagov/statistics_group_by_week_backup
Group by Notification Statistics added and all tests working.
2016-05-09 10:17:37 +01:00
Nicholas Staples
9b3d4a6087 Template history endpoint added. All tests passing.
Code quality fix.
2016-05-06 15:47:13 +01:00
Nicholas Staples
f465066a69 Group by Notification Statistics added and all tests working.
Fixed tests for upgraded client.
2016-05-05 11:04:20 +01:00
NIcholas Staples
dcd2856c67 Merge pull request #276 from alphagov/created_by_export
Update created_by to work like other relationship fields.
2016-05-03 11:07:34 +01:00
NIcholas Staples
7121a50cd1 Merge pull request #273 from alphagov/provider_statistics
Fragment count endpoint added and all tests working.
2016-04-29 12:28:54 +01:00
Nicholas Staples
09d3ae27b6 Update created_by to work like other relationship fields. 2016-04-29 12:24:43 +01:00
Adam Shimali
4e81695c84 Added limit_days filter to get notifications dao. 2016-04-28 16:51:19 +01:00
Nicholas Staples
bedc20d0ff Fragment count endpoint added and all tests working. 2016-04-28 12:01:57 +01:00
Adam Shimali
f71b626089 Merge pull request #267 from alphagov/events
Endpoint for recording events in api.
2016-04-27 11:37:33 +01:00
Adam Shimali
dacbbfbf2f Endpoint for recording events in api.
An event has an id, a type and a blob of json attached.
2016-04-27 10:36:59 +01:00
Rebecca Law
3f7bae3428 Removed update_job endpoint because it is not being used 2016-04-27 09:46:45 +01:00
Nicholas Staples
b56e324a4c Working tests and provider stats table.
Fix for tests and import error.

Added tests and updated for code review comments.
2016-04-25 12:20:06 +01:00
Adam Shimali
7378352c26 This is a temporary endpoint to get history of service and api key
updates. This will be surfaced on a simple log page on admin app
until product team work out who/how/when etc. of viewing history
data.
2016-04-21 16:32:20 +01:00
Nicholas Staples
31978bd987 Added page_size parameter for notifications api. All tests passing.
Add page_size and total parameters to all calls for notifications.
2016-04-19 11:26:21 +01:00
Nicholas Staples
1b76646170 Working placeholders in subject with upgraded notifications-utils.
Fix test.
2016-04-13 15:53:27 +01:00
Nicholas Staples
c4b316bde6 Rebased migrations, all tests working. 2016-04-08 13:34:54 +01:00
Adam Shimali
0d06be05e1 [WIP] Added dao method and rest endpoint for getting template
statistics by service.

Some cosmetic changes to imports.

Added fix for job rest not correctly returning errors.
2016-04-04 14:38:54 +01:00
NIcholas Staples
e2d0d39ea7 Merge pull request #192 from alphagov/update_filter_for_multiple_arguments
Added functionality to allow filtering by multiple arguments.
2016-04-04 14:29:53 +01:00
Nicholas Staples
fac34aff10 Added functionality to allow filtering by multiple arguments.
Removed commented out code.
2016-04-04 13:21:51 +01:00
Rebecca Law
8493e29acc Added some more tests.
Removed the validation in the schema - it was adding complexity, let the unique constraint on the db throw the exception. This should only ever happen on a race condition which seems unlikely (two people changing a service to the same name at the same time)
Do no set debug=true to the test config. If debug=true it changes the behaviour of the error handlers, throwing the exception rather than returning a 500.
2016-04-01 13:42:11 +01:00
Chris Hill-Scott
e3ae81bd0a Strip trailing CSV rows, relax phone validation
Implements (and depends on):
- https://github.com/alphagov/notifications-utils/pull/14
- https://github.com/alphagov/notifications-utils/pull/15
2016-03-24 20:30:15 +00:00
Nicholas Staples
327f169575 Filtering added and tests working. 2016-03-21 12:37:34 +00:00
Nicholas Staples
c3a15f9f30 Fix pagination bug and swapped file name with original file name. 2016-03-16 16:47:18 +00:00
Nicholas Staples
356083e8ac Update schemas to return more details about the job and template for notifications. 2016-03-15 14:24:10 +00:00
Nicholas Staples
b409e4459d Duplicate service name check added and all tests passing. 2016-03-10 10:34:46 +00:00
Rebecca Law
49198b26e7 Merge branch 'master' into reset-password
Conflicts:
	app/schemas.py
	tests/app/celery/test_tasks.py
2016-03-09 09:36:57 +00:00
NIcholas Staples
528f570ab6 Merge pull request #141 from alphagov/capture-aggregate-data
Capture aggregate data
2016-03-08 17:54:39 +00:00
Rebecca Law
114cfa6b17 Use the validation error message from the InvalidEmailError 2016-03-08 17:46:00 +00:00
Martyn Inglis
67c4bd2263 Build rest endpoint to read service stats
- get stats by service id
- returns a list of stats objects

Not paginated - have 1 row per day.
2016-03-08 16:34:03 +00:00
Rebecca Law
29a7289d1e Use new email validation.
Use logger.exception where it makes sense, not for SqlAlchemy errors as it give too much information away.
2016-03-08 15:47:35 +00:00
Rebecca Law
cbc585a1b1 Merge branch 'master' into reset-password 2016-03-08 15:40:20 +00:00
Rebecca Law
ba337374fd - Remove password_changed_at from the update_dict in users_dao
- Format dates in UserSchema
- Properly formatted subject and message body for the password reset email
- Add name to the message for reset password
2016-03-08 14:33:06 +00:00
Chris Hill-Scott
8323757441 Accept phone numbers in any valid format
This uses the `format_phone_number` method from utils to output phone numbers
in a consistent format. It is added to the schemas, so will be applied before
the API tries to do anything with a provided phone number.

So now the API will accept any of the following:
- 07123456789
- 07123 456789
- 07123-456-789
- 00447123456789
- 00 44 7123456789
- +447123456789
- +44 7123 456 789
- +44 (0)7123 456 789

…but the API will always hand off phone numbers to 3rd party APIs in the format
- +447123456789

The test for this is slightly convoluted, because template IDs are still
database IDs, and can’t consistently be mocked, therefore we have to ignore that
part of the call to `encrypt()`.
2016-03-08 09:47:21 +00:00
Chris Hill-Scott
157b385327 Use validation of recipients from utils
This was added to utils in 5914da74f1

This means that:
- we are doing the exact same validation in the API and admin app
- we are actually validating phone numbers for the correct format (hence all the
  changes to the tests)
2016-03-08 09:47:21 +00:00
Rebecca Law
10296f0cc2 Send email address in the data rather than the user_id as a path param.
Remove unused OldRequestVerifyCodeSchema.
2016-03-07 15:21:05 +00:00
Rebecca Law
3fd3aa5b3e Merge pull request #119 from alphagov/update_permission_endpoints
Update permission endpoints
2016-03-02 14:33:18 +00:00