Commit Graph

696 Commits

Author SHA1 Message Date
Rebecca Law
12a2d8db0a New endpoint to get users for service id.
/service/<service_id>/users returns a list of all users associated with the service
2016-02-23 17:53:54 +00:00
Martyn Inglis
201c2d01ba Task is the same whether job based or not
- use notification to build action
- notification has job
- based in encrypted blob
2016-02-23 17:39:08 +00:00
Martyn Inglis
635debb5a6 Moved the sending sms for a job into celery tasks 2016-02-23 17:30:50 +00:00
NIcholas Staples
8de4ae5cf2 Merge pull request #91 from alphagov/send-email-from-templates
Send Email via the API
2016-02-23 13:18:45 +00:00
Adam Shimali
21e791b25c Add endpoint for getting user by email address 2016-02-23 11:03:59 +00:00
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
Adam Shimali
c36b64c91b Added notification count to jobs. 2016-02-22 14:57:33 +00:00
Martyn Inglis
dbe914f401 Changed error format on template subject duplication error 2016-02-22 14:32:41 +00:00
Martyn Inglis
b3b3cca65f Merge branch 'master' into email-templates-part-2 2016-02-22 14:04:01 +00:00
Martyn Inglis
530c8a2faa Fixed merge issues 2016-02-22 13:27:47 +00:00
Martyn Inglis
2c51535b7e Merge branch 'master' into email-templates 2016-02-22 13:12:41 +00:00
Martyn Inglis
886b206d63 Merge branch 'master' into email-templates
Conflicts:
	app/user/rest.py
	tests/app/user/test_rest.py
2016-02-22 13:12:24 +00:00
Nicholas Staples
c8bb96b883 Fixes added. 2016-02-22 13:02:09 +00:00
Martyn Inglis
9bb95a53ec Updates to template endpoints:
- moved into templates rest class
- updated dao
- removed delete methods
- constraint on subject line
2016-02-22 12:55:18 +00:00
Nicholas Staples
180caf3ce6 Merge with master
.
2016-02-22 11:07:37 +00:00
Martyn Inglis
443691402f Slight tiny up of templates_dao
- 1 method per get query
- logic around create/update removed
2016-02-22 09:46:16 +00:00
Martyn Inglis
cc720b137f Merge branch 'master' into email-templates
Conflicts:
	app/user/rest.py
2016-02-19 17:33:28 +00:00
Martyn Inglis
98314485d3 Generate the email_from from the service name. 2016-02-19 17:07:59 +00:00
Rebecca Law
04ca1bc00f Remove code_type 2016-02-19 16:06:45 +00:00
Martyn Inglis
dc294c32ae Fix all other dependant classes that are affected by the DAO / Service / Model changes 2016-02-19 15:54:11 +00:00
Martyn Inglis
1a136885c3 Update service rest class to handle new fields and updated dao 2016-02-19 15:53:45 +00:00
Martyn Inglis
5bfae689c2 Refactored the services dao to be a little cleaner
- some things we don't need
	- bulk update of users
	- delete service

Now returns None if can't find an object
2016-02-19 15:53:15 +00:00
Nicholas Staples
0396148853 Permissions added. 2016-02-19 14:47:45 +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
Rebecca Law
9ea2acfdae Use dashes in the celery queue names 2016-02-18 11:18:35 +00:00
minglis
9b99782662 Merge pull request #83 from alphagov/celery-send-email-code
Celery send email code
2016-02-18 11:03:23 +00:00
Rebecca Law
4d9d511575 Merge pull request #81 from alphagov/celery-send-sms-code
Use Celery to send sms code
2016-02-18 10:51:16 +00:00
Rebecca Law
aff948e9ca Merge branch 'celery-send-sms-code' into celery-send-email-code
Conflicts:
	app/celery/tasks.py
	app/user/rest.py
	scripts/run_celery.sh
2016-02-18 10:50:14 +00:00
Rebecca Law
3ce6758f3e Change names for clarity sake.
Rename test.
What we do when the validation_code fails to send is still to be decided.
2016-02-18 09:59:18 +00:00
Rebecca Law
c1df61a7d4 Use celery to send the email verification code. 2016-02-18 09:52:27 +00:00
Rebecca Law
9073814d9f I have an issue with the test, not sure why? 2016-02-17 17:48:23 +00:00
Adam Shimali
4f33b6f406 Wire up error handlers.
Replace some 400s with more appropriate 500s.

DAO methods that cause unexpected exceptions get caught and
logged by errors.py 500 error handler.
2016-02-17 17:04:50 +00:00
Rebecca Law
66cf6cfd30 Use Firetext client 2016-02-17 15:52:09 +00:00
Rebecca Law
7afa87c367 Merge branch 'master' into celery-send-sms-code
Conflicts:
	tests/app/celery/test_tasks.py
2016-02-17 15:43:57 +00:00
Rebecca Law
d022d036dc Celery task to send the sms verify code.
Each celery task will use it's own queue.
2016-02-17 15:41:33 +00:00
Martyn Inglis
837c9b7cdb Removed logging, and make fire text only client. 2016-02-17 13:59:01 +00:00
Martyn Inglis
e0e47b40fc Setup celery config 2016-02-17 10:22:25 +00:00
Martyn Inglis
85a8e6d2b4 Added moto back for methods not yet celery'd 2016-02-17 09:47:34 +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
a2341be0e2 Don't send the SMS if we have failed to save in the database 2016-02-16 17:42:04 +00:00
Martyn Inglis
0933e5c647 Building tests for the tasks class 2016-02-16 17:17:02 +00:00
Rebecca Law
08ba5de61b Update config
Source the configuration from an environment file, this way it is similar to how the aws environment works
2016-02-16 16:01:50 +00:00
Martyn Inglis
18d63e241b Extracted serialiser for encryption into a flask module
- allows mocking easier
- shared across methods
- not built everytime
2016-02-16 15:28:30 +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
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
Rebecca Law
0cd5fa278b Fix a intermittent test.
Removed the need for sample_admin_service_id in service/test_rest
2016-02-10 13:09:36 +00:00
Rebecca Law
2db0f9737e Added a test to check endpoint works with an id in payload. 2016-02-10 12:46:52 +00:00
Rebecca Law
a01828a6d0 Return notification_id on create notification endpoints
- /notification/sms
 - /notification/email
 - /notificaiton/sms/service/<service_id>
Update message attribute on SQS to notification_id from message_id
2016-02-10 12:46:52 +00:00
Adam Shimali
3a2cfc96e6 job on notification now nullable. 2016-02-10 11:08:24 +00:00