Commit Graph

35 Commits

Author SHA1 Message Date
Martyn Inglis
b01782bbe6 Send Email via the API
- uses the new subject/email from fields present on the templates / service tables
- brings the send email api call into line with the sms one.
- same fields (to/template_id)
- same rules regarding restricted services
- wired in as a task into celery

Requires
- new celery queue
- new env property (NOTIFY_EMAIL_DOMAIN)
2016-02-22 17:17:29 +00:00
Rebecca Law
17d14f291e Refactor user/<user_id>/code into two endpoints.
- Created new endpoint user/<user_id>/sms-code to send the sms verification code to the user.
- Create new endpoirtn user/<user_id>/email-code to send the email verifcation code to the user.
- Marked the old methods, schema, tests with a TODO to be deleted when the admin app is no longer sending messages to /user/<user_id>/code
- Added error handlers for DataError and NoResultFound. Data error catches invalid input errors.
- Added error handler for SqlAlchemyError which catches any other database errors.
- Removed the need for the try catches around the db calls in the user endpoints with the addition of the db error handlers.
- We may want to wrap db excpetions in the dao, if we want the No results found message to be more specific and say no result found for user.
2016-02-19 11:37:35 +00:00
Martyn Inglis
cb265896a7 Merge branch 'master' into move-sms-notifications-into-celery
Conflicts:
	app/__init__.py
	tests/conftest.py
2016-02-17 09:14:37 +00:00
Martyn Inglis
e42da7dd54 Fixing up tests to validate the call to the celery tasks.
- mocker used to test call or otherwise of the task
- no new tests just a spring clean
2016-02-16 14:06:56 +00:00
Martyn Inglis
655beddba6 Fixed up the get_notitication endpoint
- returns a notification
2016-02-16 11:22:44 +00:00
Rebecca Law
fcaed04918 Fix validation of template for service.
When the delivery app creates the sms on behalf of the service,
the validation was failing.
2016-02-15 15:02:19 +00:00
Nicholas Staples
1eb18e7f07 Code review fix. 2016-02-12 14:08:48 +00:00
Nicholas Staples
918c561726 Code added to now check service id matches the authorization token service for sending an sms. 2016-02-12 11:13:54 +00:00
Adam Shimali
17e5e70f6c [WIP] Added endpoints under /job for creating, updating and reading
notification status.
2016-02-09 14:17:42 +00:00
Adam Shimali
0580f5ab06 New endpoint for delivery app to use.
Once removal of code that uses existing alpha is done, then
duplicated code from /notifications/sms and the new endpoint
can be merged.

Job id is now avaiable in notificaiton but is not used yet.
2016-02-08 14:54:15 +00:00
Nicholas Staples
6286646d7f Fix for review comments. 2016-02-03 15:53:16 +00:00
Nicholas Staples
aba1cd2ed5 Sqs queues now populated from all create_notification api calls. Marshmallow schemas added for notification. 2016-02-03 13:16:19 +00:00
Rebecca Law
b5c662eca8 Change services.id to a UUID
Ideally all the primary keys in the db would be UUID in order to guarantee unique ids across distributed dbs.
This updates the services.id to a UUID. All the tables with a foreign key to the services.id are also updated.
The endpoints no longer state a data type of the <service_id> path param.
All the tests are updated to reflect this update.

The thing to pay attention to is the 0011_uuid_service_id.py migration script.
This commit must go with a commit on the notifications_admin app to keep things working.
There will be a small outage until both deploys have happened.
2016-02-02 14:22:22 +00:00
Rebecca Law
0b62005983 Move VERIFY_CODE_TYPES outside the class and use it in the schema 2016-02-01 10:54:32 +00:00
Rebecca Law
cec0d40e5b Create schema for RequestVerifyCodeSchema
Previously we were using a schema that mapped onto db.Model. However, the json
in the request did not reflect the VerfiyCode db Model.
I did not add validation on the to field, we did not have that previously.
2016-02-01 10:48:33 +00:00
Nicholas Staples
2451f7e53d Added support for validation only of put requests. 2016-01-29 11:11:00 +00:00
Adam Shimali
9bf11b3d40 Merge pull request #39 from alphagov/add_password_update
Added support for allowing password to updated from the PUT request t…
2016-01-28 11:54:26 +00:00
Nicholas Staples
66c1d858ac Added support for allowing password to updated from the PUT request to the user rest endpoint. 2016-01-28 11:41:21 +00:00
Rebecca Law
42a4c8b0b1 Add sms notifications from a service to a queue. 2016-01-27 17:42:05 +00:00
Nicholas Staples
6b035cd324 All tests working, second time around. 2016-01-21 17:29:24 +00:00
Rebecca Law
9eb856b86e Get api_keys for service endpoint 2016-01-20 15:24:13 +00:00
Rebecca Law
15b2d414cc Updates from review comments:
Update api_key relationship.
Check that id in dict exists before deleting it
2016-01-19 13:11:22 +00:00
Rebecca Law
4fc5c34320 Change Tokens to ApiKey
Added name to ApiKey model
2016-01-19 12:13:47 +00:00
Adam Shimali
f839bae1f5 Add rest of user model fields to api.
First step to moving user interactions to api.
2016-01-19 11:39:59 +00:00
Adam Shimali
834801d19b Added endpoints for creating job, and getting job/jobs. 2016-01-15 15:48:05 +00:00
Adam Shimali
b9f6db1856 Added model and dao for Jobs. 2016-01-15 11:12:05 +00:00
Rebecca Law
436f45b70d Moved the _generate_token methods to the tokens_dao. 2016-01-14 11:30:45 +00:00
Rebecca Law
4a692d555e Create a relationship between services and tokens 2016-01-14 10:19:22 +00:00
Rebecca Law
725b976d31 Created endpoints for create and delete token. 2016-01-14 10:17:36 +00:00
Rebecca Law
3a3f9becec Add api_token model and dao 2016-01-14 10:15:28 +00:00
Nicholas Staples
99820b3e85 More tests for rest and dao. 2016-01-13 12:14:21 +00:00
Nicholas Staples
dad0fff4ba Template rest api skeleton added. 2016-01-13 11:04:13 +00:00
Nicholas Staples
74547013ba All four http methods working now for user and service restful apis. 2016-01-11 17:19:06 +00:00
Nicholas Staples
49e98c21e7 Service and User API added, working with tests. Still need to polish the edges and add more tests. 2016-01-11 15:07:13 +00:00
Nicholas Staples
0bc4d02713 Work in progress, skeleton of the api created and testing started. Need to fix authentication tests. 2016-01-08 17:51:46 +00:00