Commit Graph

160 Commits

Author SHA1 Message Date
Chris Hill-Scott
4a7267be8b Add an endpoint to cancel a job
If you schedule a job you might change your mind or circumstances might
change. So you need to be able to cancel it. This commit adds a `POST`
endpoint for individual jobs which sets their status to `cancelled`.

This also means adding a new status of `cancelled`, so there’s a
migration…
2016-09-02 12:27:02 +01:00
Martyn Inglis
ab5ff64dd0 Indexes to improves stats for service query 2016-08-31 16:24:18 +01:00
Martyn Inglis
805da23d6b Starting to implement scheduling 2016-08-24 14:04:52 +01:00
Martyn Inglis
5adecda41e Adds new job_status table and FK to jobs.
This will replace the job_status enum type.
2016-08-24 13:34:42 +01:00
Leo Hemsted
d7945d85dc update ukvi org branding spelling
was previously UK Visas and Immigration
now UK Visas & Immigration
2016-08-22 16:12:09 +01:00
Leo Hemsted
d38fdb2d11 add organisation and branding models
a service now has branding and organisation_id columns, and two new
tables have been aded to reflect these:
* branding is a static types table referring to how a service wants
  their emails to be branded:
    * 'govuk' for GOV UK branding (default)
    * 'org' for organisational branding only
    * 'both' for co-branded output with both
* organisation is a table defining an organisation's branding. this
  contains three entries, all of which are nullable
    * colour - a hex code for a coloured bar on the logo's left
    * logo - relative path for that org's logo image
    * name - the name to display on the right of the logo
2016-08-09 16:03:04 +01:00
Leo Hemsted
c7d909be03 add UKVI as first organisation branding 2016-08-09 15:59:22 +01:00
Leo Hemsted
a6cd490942 add organisation and branding models
a service now has branding and organisation_id columns, and two new
tables have been aded to reflect these:
* branding is a static types table referring to how a service wants
  their emails to be branded:
    * 'govuk' for GOV UK branding (default)
    * 'org' for organisational branding only
    * 'both' for co-branded output with both
* organisation is a table defining an organisation's branding. this
  contains three entries, all of which are nullable
    * colour - a hex code for a coloured bar on the logo's left
    * logo - relative path for that org's logo image
    * name - the name to display on the right of the logo
2016-08-09 15:59:16 +01:00
Leo Hemsted
d86af3ce83 fix syntax errors in downgrade script 2016-08-04 12:00:26 +01:00
Leo Hemsted
527a5c4eaa calculate billable units when sending an sms
don't calculate it if we're in research mode
* added tests to prove this
* removed last code referring to content_char_count
2016-08-03 16:46:05 +01:00
Leo Hemsted
2793541b9c add billable_units column to notifications table
this replaces content_char_count, by performing the additional
steps to calculated billable units at insert time, rather than
read time. This means we can take into account whether the
service was in research mode or using a test api key when the
notification was sent :tada
2016-08-03 16:41:06 +01:00
Martyn Inglis
daf85e7787 Reorder the SQL scripts as clash 2016-08-01 15:19:16 +01:00
minglis
54a63c0351 Merge pull request #544 from alphagov/job-notification-history
Create notification history from jobs
2016-08-01 15:04:15 +01:00
Martyn Inglis
cfb29d4404 Ensure the downgrade script targets only DMP services 2016-08-01 12:20:06 +01:00
Leo Hemsted
6edb9324da add indexes to notifications and notification_history 2016-08-01 11:34:20 +01:00
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
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
Leo Hemsted
fb7e9dfcb3 copy existing notifications into history table 2016-07-12 13:45:19 +01:00
Leo Hemsted
4ef084464d update notification_history table from notification_dao create/update functions
please ensure that any changes to notifications table happen through either dao_create_notification or dao_update_notification.
changed the notification status update triggered by the provider callbacks to ensure that sets updated_by and can update the history table.
also re-added the character_count so we can reconstruct billing data if needed.
2016-07-12 13:28:45 +01:00
Leo Hemsted
722699a72a Update notification_history table on insert/update of notifications
triggered via calls in dao_create_notification and dao_update_notification - if you don't use those functions (eg update in bulk) you'll have to update the history table yourself!
2016-07-12 13:27:31 +01:00
Leo Hemsted
47ef63adbe add notification_history table
table will be used for storing archival versions of notifications. It's an exact duplicate of notifications table, but with the following modifications:
* removed _personalisation
* removed to
* removed content_char_count

All foreign keys to other tables still exist. additionally, removed defaults (for id and created_at) since they'll be set when we create, and we should ensure that we don't forget about them when inserting/udpating this table.
2016-07-12 13:27:31 +01:00
Rebecca Law
36ecdca04c Add new email template for the GOV.UK Notify service, to send an email to users that register with the same email address.
Add a new endpoint to send the email.
2016-07-07 17:23:07 +01:00
Rebecca Law
55adc9239f Fix update script 2016-07-07 16:01:04 +01:00
Rebecca Law
638ea1b12b Set the start date for the new rate as July 1 2016-07-07 14:31:50 +01:00
Leo Hemsted
2b7972dc1d mmg rates set to 1.65p
note this db value not actually used in app yet
2016-07-06 16:02:10 +01:00
Rebecca Law
764bfc6203 Fix file name for migration script 2016-07-06 14:46:46 +01:00
Rebecca Law
a1209ed9a4 Merge branch 'master' into fix-count 2016-07-06 14:45:10 +01:00
Rebecca Law
8bea8b6a8f Fix bug where all notifications were getting a type = email.
Includes a fix to notification and notification_statistics data.
2016-07-06 14:31:52 +01:00
Leo Hemsted
a5e488c035 add test api key type 2016-07-05 16:20:02 +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
Leo Hemsted
f992240192 make notification.key_type not nullable
set to 'normal' for all existing notifications, and all job notifications also created as 'normal' - so if your eg reporting service hits notify, it gets notifications created from both API calls and front-end csv jobs.
2016-07-01 16:36:11 +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
Rebecca Law
25db1bce74 Use the notification types enum for the notifications.notification_type.
Reuse EMAIL_TYPE in template_types and notification_types.
2016-06-29 11:50:54 +01:00
Rebecca Law
60e159e3c0 Add notification_type to notification table.
It seems like an oversight not to include the notification type in the notifcation.
When updating statistics a query to the template table is required to get the type, this update will mean that query does not have to happen.
2016-06-29 11:23:02 +01:00
Rebecca Law
90ba1ec152 Add downgrade 2016-06-28 14:45:12 +01:00
Rebecca Law
abb9135e35 Password changed at is defaulted to the current date when the user is created.
This PR set the users.password_changed_at column to not be nullable.
2016-06-28 11:24:08 +01:00
Leo Hemsted
e9482c7fe1 add new key_type table
* single-column static data table that currently contains two types: 'normal' and 'team'
* key_type foreign-keyed from api_keys
  - must be not null
  - existing rows set to 'normal'
* key_type foreign-keyed from notifications
  - nullable
  - existing rows set to null
* api_key foreign-keyed from notifications
  - nullable
  - existing rows set to null
2016-06-24 15:56:54 +01:00
Rebecca Law
7f4d048d75 Fix downgrade to work if any notifications have status = 'created' 2016-06-21 15:55:39 +01:00
Rebecca Law
8caa688bf5 Add created as a status for notifications 2016-06-21 13:41:46 +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
Rebecca Law
f8262b13c1 Refactor permissions dao - removed custom query filter
Removed permissions rest - not being used.
2016-06-15 16:32:52 +01:00
Martyn Inglis
d5259be44c moved migration script from
https://github.com/alphagov/notifications-api/pull/412

To ship it quickly as preview broken without it.
2016-06-14 09:22:07 +01:00
Rebecca Law
ea80596e73 Correct template id for email verification template in the history table.
Correct personalisation name when sending registration message.
2016-06-13 14:57:59 +01:00
Nicholas Staples
bbd64b088b Added migration to add rate. Tested worked locally. 2016-06-08 10:34:09 +01:00
Rebecca Law
4d072cb113 Rename notify service to GOV.UK Notify 2016-06-07 09:55:10 +01:00
Rebecca Law
ba67b0c89d Change email address of user.
Removed permissions because it not a real user or person.
2016-06-03 10:51:34 +01:00
Rebecca Law
4910483f39 Add a service that will be used to send Notify's messages.
Including sms code, email verification, invitation emails, and password reset emails
Added the service id and template ids to config.
Small change to dao_create_service to use id if set.
2016-06-02 15:34:43 +01:00
Martyn Inglis
290f416485 Various tidy ups and changes
- use new queue
- remove some new lines in AWS response data
- migration script to populate new fields
2016-06-01 16:57:57 +01:00
Martyn Inglis
9aa727e0cf Add research mode to service/history tables
- added as a nullable boolean column.
2016-05-31 11:29:20 +01:00