Commit Graph
100 Commits
Author SHA1 Message Date
Adam Shimali 183fc7d639 After doing some tests locally. To get this to run in a reasonable
amount of time I've made the following changes.

Only migrate jobs for the Digital Marketplace service.

Batch up commits to run per job.
2016-07-26 16:23:36 +01:00
Adam Shimali 58dece0049 Merge pull request #553 from alphagov/statsd-bugfix
Statds value error
2016-07-22 14:16:21 +01:00
Adam Shimali cfd42a8a05 Statsd timings were being passed a timedelta instead for float for
milliseconds.

Bugfix for https://www.pivotaltracker.com/story/show/126852733
2016-07-22 12:13:24 +01:00
Adam Shimali 3b8a163ff2 Db migration to retrospectively create notification history from
jobs table.

The migration selects only jobs from after the go live date and before
the earliest record in notication history table.
2016-07-19 16:46:17 +01:00
Adam Shimali 6f1063ba7f Merge pull request #533 from alphagov/message-limit-fix
Daily message limit imposed for service api calls.
2016-07-14 13:37:07 +01:00
Adam Shimali 9f9040869d Daily message limit imposed for service api calls. 2016-07-14 11:25:45 +01:00
Adam Shimali 8dafab952e Merge pull request #501 from alphagov/fix-alembic-clash
Fix alembic clash.
2016-07-04 10:50:11 +01:00
Adam Shimali 1f4fc77a1e Fix alembic clash. 2016-07-04 10:45:56 +01:00
Adam Shimali 19f2ccb594 Merge pull request #498 from alphagov/set-sms-sender-api
Set sms sender on service
2016-07-04 10:32:04 +01:00
Adam Shimali b32f0ab2cd Resolve conflicts 2016-07-01 16:53:12 +01:00
Adam Shimali c29dd23702 Add sms sender to service to be used in sms templates
in place of default numeric short code.

If not present default short code is used.
2016-07-01 15:27:54 +01:00
Adam Shimali abbd106212 Merge pull request #469 from alphagov/notifications-body-bug-fix
Body of notification without placeholder should have been present.
2016-06-23 16:05:38 +01:00
Adam Shimali 0e2e99f64e notifications_utils Template constructor accepts None for
personalisation data therefore None check not needed.

If personalisation is None in in db it will get passed through to
template which returns content.
2016-06-23 15:35:35 +01:00
Adam Shimali 3423c0c44d Added subject for email templates 2016-06-23 15:21:03 +01:00
Adam Shimali f65b86cfc9 Body of notification without placeholder should have been present. 2016-06-23 10:25:07 +01:00
Adam Shimali ed5bdb7be8 Merge pull request #467 from alphagov/notification-created-status
Notification created status for send_sms
2016-06-23 10:21:43 +01:00
Adam Shimali 4cb67e8767 Merge pull request #454 from alphagov/store-notification-personalisation
Store personalisation with notification
2016-06-21 10:57:14 +01:00
Adam Shimali 731bb19a9c Template and personalisation content is now merged and returned with
notifications, when retrieved by notification id, or service id (i.e.
all notifications for service).

There is a new element returned at top level of notification json called
body, which is the template content merged with personalisation. This
is consistent with api to endpoint to create notification which returns
what was sent as 'body' in json response.

Merging of template with personalisation is done in the
NotificationStatusSchema.

Personalisation data in encrypted before storing in db.
2016-06-20 16:49:17 +01:00
Adam Shimali 5378e6ebc1 Merge pull request #434 from alphagov/notification-stats-by-day
Endpoint for reading notification stats for a given day.
2016-06-17 12:03:40 +01:00
Adam Shimali dd8372a572 Updated for git comments 2016-06-17 10:15:57 +01:00
Adam Shimali db22373a6b Endpoint for reading notification stats for a given day. 2016-06-16 17:02:33 +01:00
Adam Shimali 92fdba7010 Merge pull request #424 from alphagov/more-error-logging
Make errors return via error handlers in errors.py
2016-06-16 09:34:20 +01:00
Adam Shimali c268401554 Updated for pr comments 2016-06-15 16:19:28 +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
Adam Shimali da45a997f3 Merge pull request #410 from alphagov/better-error-logging
Better error logging
2016-06-13 15:05:17 +01:00
Adam Shimali 3d55c47d1e Rest methods that explicitly return errors by pass the error handlers as
they do not raise exceptions.

Introduced a simple exception that contains error messages and status
code that can be used rather than return json + status code from rest
methods directly.

The handler in errors for this exception can then log the error before
returning json.
2016-06-13 13:50:35 +01:00
Adam Shimali 29fc470fb5 Merge pull request #392 from alphagov/missing-permissions-fix
[WIP] Permissions being removed
2016-06-07 16:54:59 +01:00
Adam Shimali e28ef237e4 When adding a user new with permissions to a service, the permissions
dao was deleting all permissions for that user (regardless of service
id) as the last filter on the permissions dao get_query method won.

I've added a replace flag to the set_user_service_permission method
so that it can handle adding new users + permissions and editing
of existing users' permissions.

Also by pass the get_query method until it can be refactored to work
correctly.

For now execute the filter query directly on the model.
2016-06-07 16:35:26 +01:00
Adam Shimali 207d9088c4 Merge pull request #384 from alphagov/invite-permissions-fix
API receives full set of permission names
2016-06-07 09:36:32 +01:00
Adam Shimali 63c29a3a3d API recieves full set of permissions names on create of user
invite. This is instead of mapping from permission groups to individual
permissions on user creation.
2016-06-06 12:37:06 +01:00
Adam Shimali 17f7ba952c Merge pull request #328 from alphagov/mmg-response-status
Added additional outcome status codes to mmg responses.
2016-05-19 13:06:48 +01:00
Adam Shimali 955005d7fe Added additional outcome status codes to mmg responses. 2016-05-19 11:27:22 +01:00
Adam Shimali d5c4af957c Merge pull request #320 from alphagov/fix-reply-to
Was incorrectly setting from not reply to
2016-05-17 14:50:08 +01:00
Adam Shimali e1685d6a45 Was incorrectly setting from not reply to 2016-05-17 14:31:33 +01:00
Adam Shimali f432ca33c5 Merge pull request #317 from alphagov/send-using-reply-to
Send using reply to
2016-05-17 13:06:52 +01:00
Adam Shimali 3812dac3fe Missing mock 2016-05-17 12:49:37 +01:00
Adam Shimali 642fb6f68b Process job for email uses reply to if present 2016-05-17 12:41:13 +01:00
Adam Shimali 91c92ad524 Merge pull request #316 from alphagov/save-reply-to
[WIP] save reply to email address on service
2016-05-17 11:40:32 +01:00
Adam Shimali 682ea55d9e [WIP] save reply to email address on service 2016-05-17 10:56:02 +01:00
Adam Shimali ba874cfd43 Only trigger dependent build for master, staging and live 2016-05-11 12:39:39 +01:00
Adam Shimali 8f8245885e Pass branch name to dependent build 2016-05-10 14:15:38 +01:00
Adam Shimali fc1345acdf Trigger dependent build for preview 2016-05-10 12:39:35 +01:00
Adam Shimali 553ef6bfc8 Merge pull request #279 from alphagov/status-page-error
Add delivery status endpoint
2016-04-29 15:08:35 +01:00
Adam Shimali b51ee0b4d0 Add delivery status endpoint 2016-04-29 13:00:21 +01:00
Adam Shimali 87a02cba14 Merge pull request #274 from alphagov/one-week-activity
Added limit_days filter to get notifications dao.
2016-04-28 16:56:39 +01:00
Adam Shimali 4e81695c84 Added limit_days filter to get notifications dao. 2016-04-28 16:51:19 +01:00
Adam Shimali 23bcb08fb2 Merge pull request #272 from alphagov/temp-api-event-view
Add events to temporary history view for story sign off.
2016-04-28 10:48:37 +01:00
Adam Shimali 078756919d Add events to temporary history view for story sign off. 2016-04-27 17:30:15 +01:00
Adam Shimali c2d3e021cc Fix migration name clash 2016-04-27 11:48:46 +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
Adam Shimali f82ed164e6 Merge pull request #260 from alphagov/notification-delete-schedule
Use short dates when selection notifications for deletion.
2016-04-25 17:28:19 +01:00
Adam Shimali 886f302993 Removed unused code 2016-04-25 17:21:55 +01:00
Adam Shimali 9bb3214b1c Removed wandering code 2016-04-25 17:13:12 +01:00
Adam Shimali 24ea6f1637 Use short dates when selection notifications for deletion.
This means we will retain notifications for a full week and not
delete records that are 7 x 24 hours older than the time of the run of
the deletion task.

Also the task only needs to run once a day now, so I have changed
the celery config for the deletion tasks.
2016-04-25 16:12:46 +01:00
Adam Shimali d14be2067c When using the versioned decorator I noticed that when adding or
revoking an api key the service it associated with was of course added
to db.session.dirty.

That resulted in an updated version of service being added to the
service history table that showed no visible difference from that
record immediately precending it as the change was to another table,
namely the api_key table. A new api key or revoked api key was correctly
added to api_key and api_key_history tables. However I think an
'unchanged' service history record may be a bit confusing as you'd need
to correlate with api_keys to work out what the change was.

I think it's best to just record the new/revoked api_key and not create
another version of the service.

This pr wraps the exisiting versioned decorator with one that take a
class which you are interested in versioning.

Using the new decorator you only get a new version and history record
for the class you pass to outer decorator.

If the exising behaviour is acceptable to the powers that be then by all
means ignore/close this pr.
2016-04-21 18:10:57 +01:00
Adam Shimali 783271f306 Merge pull request #256 from alphagov/temp-endpoint-for-history
Temp history of endpoint
2016-04-21 17:05:01 +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
Adam Shimali 68eabd0676 Merge pull request #255 from alphagov/api-keys-history
Added version history to api keys.
2016-04-21 15:43:27 +01:00
Adam Shimali 252386c3c9 Changes for pr comments 2016-04-21 15:22:26 +01:00
Adam Shimali 873b8d1312 Reverted commented out tests 2016-04-21 15:15:32 +01:00
Adam Shimali 74ac5b5f30 Added version history to api keys. This needed a bit of change
to create history to handle foreign keys better. There may yet
be a better way of doing this that I have not found yet in sqlalchemy
docs.
2016-04-21 14:47:58 +01:00
Adam Shimali a38e4f4965 Merge pull request #249 from alphagov/notification-stats-date
Changed notifications stats day column to date type from string.
2016-04-20 15:54:33 +01:00
Adam Shimali 054d8baa0a Changed notifications stats day column to date type from string. 2016-04-20 15:38:06 +01:00
Adam Shimali 6ef8bb5ada Merge pull request #236 from alphagov/record-service-history
A slightly manual way of recording history.
2016-04-19 17:18:19 +01:00
Adam Shimali 8ea8bba612 Fix migration downgrade 2016-04-19 17:13:26 +01:00
Adam Shimali a6a18c1a6f This approach uses part of sqlalchemy example history_meta code
adapted to recording inserts and updates.

This removes need to manually create history tables.

Our code still remains in control of when history records are
created.
2016-04-19 17:13:26 +01:00
Adam Shimali 66e0f225a9 Merge pull request #205 from alphagov/fix-for-stats-window
Fix for date range required for template stats
2016-04-07 10:01:33 +01:00
Adam Shimali 4ed2e7f8f2 Fix for misunderstanding about date range required for templates
stats.

It should always be last n days, whether or not there is data.
2016-04-07 09:30:02 +01:00
Adam Shimali 3912cd95aa Merge pull request #204 from alphagov/add-timestamp-to-template-stats
Change sort order for templates
2016-04-06 15:10:59 +01:00
Adam Shimali 3057641e40 Change sort order for templates from name to date using full timestamp
so that it would be most recently used at top.
2016-04-06 14:30:13 +01:00
Adam Shimali f4b69a37d4 Merge pull request #196 from alphagov/template-stats-order
Additional sort order by template name for template statistics.
2016-04-05 09:56:37 +01:00
Adam Shimali f6620792b5 Additional sort order by template name for template statistics. 2016-04-04 17:51:24 +01:00
Adam Shimali 30f0ca3e43 Merge pull request #191 from alphagov/wip-read-template-statistics
[WIP] Added dao method and rest endpoint
2016-04-04 15:00:14 +01:00
Adam Shimali e4a5e3890a Corrected error message format 2016-04-04 14:51:56 +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
Adam Shimali 1f92255352 Merge pull request #188 from alphagov/wip-template-stats
[WIP] On create of notification. Upsert record for template stats
2016-04-01 10:00:33 +01:00
Adam Shimali 0d0cfbb6ac Better test for failed update of stats 2016-03-31 17:20:57 +01:00
Adam Shimali efc382f18b Added test to verify a number of notications followed by a failure does
not increment stats counts.
2016-03-31 16:53:47 +01:00
Adam Shimali ca9c886c3e [WIP] On create of notification. Upsert record for template stats
recording usages of template by day.
2016-03-31 15:57:50 +01:00
Adam Shimali ed1d988bf4 Merge pull request #184 from alphagov/notifications-return-change
Align notifications api with docs and other endpoints
2016-03-24 16:24:43 +00:00
Adam Shimali 7bc81528bb Post endpoint to create notificaition and get endpoint
to retrieve notification by id return data in shape more
consistent with other api endpoints.
2016-03-24 13:34:45 +00:00
Adam Shimali b83ed758f4 Merge pull request #165 from alphagov/email-registration-link
Added task for sending email verification links
2016-03-18 11:03:21 +00:00
Adam Shimali 2d1d883283 Added task for sending email verification links out on intial
registration.

Left original email code endpoint in as it is still used for things like
email change.
2016-03-17 15:21:04 +00:00
Adam Shimali f945253596 [WIP] Changed add user to service to take list of permissions instead
of invite.
2016-03-03 17:36:21 +00:00
Adam Shimali fc8e27e582 [WIP] When user is added to a service a list of permissions groups are
used to assign the correct permissions to the user.

Last slice will be to update invite status.
2016-03-03 16:38:12 +00:00
Adam Shimali 26120e4e7f Merge pull request #122 from alphagov/correct_permission_enums
Permission enums corrected, all tests passing.
2016-03-02 17:22:03 +00:00
Adam Shimali ac9adc292b [WIP] Change status code to 404 rather than 400. 2016-03-01 15:51:22 +00:00
Adam Shimali 993bdc8055 [WIP] use correct dao function for adding user to service.
Check for no user returned from user dao and return correct
error message.
2016-03-01 15:36:31 +00:00
Adam Shimali 9fe08d480c Merge pull request #114 from alphagov/cancel-invited-user
New endpoint to update invited user.
2016-03-01 15:17:03 +00:00
Adam Shimali 3b66745677 [WIP] Start of api for accepting invite. 2016-03-01 14:13:38 +00:00
Adam Shimali 5aa2243e81 Merge pull request #110 from alphagov/invitation
Email invitation to user
2016-02-29 16:25:04 +00:00
Adam Shimali 59aec1939c [WIP] invited user now has comma separated permission values
stored against it so that user can be created with correct
permissions.
2016-02-29 14:05:02 +00:00
Adam Shimali 6f786143c8 Merge pull request #105 from alphagov/create_permissions_on_service_creation
Create permissions on service creation
2016-02-29 14:00:32 +00:00
Adam Shimali faa55672cb Merge pull request #104 from alphagov/add_user_permissions
Add user permissions
2016-02-29 13:44:30 +00:00
Adam Shimali df61e0366e Merge pull request #103 from alphagov/add_service_permission
Working permissions and all tests passing.
2016-02-29 11:27:44 +00:00
Adam Shimali abb46e0a9f Merge pull request #100 from alphagov/service-not-found-returns-404
Fix get_users_by_service to return 404 if service does not exist.
2016-02-25 15:47:11 +00:00
Adam Shimali ab495d983e Merge pull request #99 from alphagov/celery-jobs
Celery jobs
2016-02-25 15:30:29 +00:00
Adam Shimali 3b11cfc8e5 Fix for intermittent failure 2016-02-25 12:27:42 +00:00
Adam Shimali 99c9cd608c [WIP] changed dao query to use .first and return specific not found
error message from rest view method.
2016-02-25 12:13:25 +00:00