Commit Graph

107 Commits

Author SHA1 Message Date
Rebecca Law
b1b231ba90 Merge branch 'master' into sms_sender_id-for-post-notfications 2017-10-30 15:20:39 +00:00
Rebecca Law
db6668eb61 Added the notification_to_sms_sender mapping table to the purge notifications query 2017-10-30 15:17:01 +00:00
venusbb
c991df3209 Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-10-26 20:47:18 +01:00
Rebecca Law
1998034b52 Refactored the get_detailed_services to stop using marshmallow.
Also removed an extra query to services.
The query has been refactored to use an outer join to services on the notifications or notification_history table.
The expectation is that this change will improve the performance of the trial/live-services pages for platform admins.
2017-10-26 12:15:52 +01:00
venusbb
9aa7489655 incorporate reviewers comments 2017-10-26 11:49:56 +01:00
Rebecca Law
61a68a2d13 [WIP] 2017-10-25 16:47:39 +01:00
venusbb
8ad98f2806 create entry when creating a new service 2017-10-25 11:35:13 +01:00
Rebecca Law
d1561903ed [WIP]
Removing marshmallow from the get_services endpoint should give us better performance.
2017-10-25 10:40:02 +01:00
Rebecca Law
ce13e62d84 Merge pull request #1332 from alphagov/improve-platform-admin
Improve platform admin
2017-10-24 10:25:54 +01:00
Rebecca Law
bfb8528ea9 The /platform-admin takes a long time, probably because the marshmallow schema used joins to the service table to return all the service data and is inefficient.
The query itself has not been improved much at all but by not using a marshmallow schema I hope to get the performance gain I am looking for.
2017-10-23 10:58:06 +01:00
Chris Hill-Scott
46d45d8595 Make international SMS on for new services
International SMS is a mature, documented feature now. There’s no reason
it shouldn’t be available to everyone. If it’s turned off by default
then we’re relying on people finding it in the settings page to know
that it exists (which we found in research the other week that users,
who would have benefitted from having international SMS, were failing to
do).

This also fixes the problem whereby users signing up for Notify with an
international phone number (eg those working abroad for the Foreign and
Commonwealth Office) couldn’t get through the tour because they weren’t
able to send themselves the example text message (see
https://www.pivotaltracker.com/story/show/150705515).
2017-10-19 11:43:27 +01:00
venusbb
9a5addb896 Reverse codes that uses filtering of trial mode services 2017-10-02 12:00:52 +01:00
venusbb
34430ac97e tidy up codes and tests 2017-09-25 09:44:16 +01:00
venusbb
d59a1f447a Progress: Today stats completed 2017-09-22 11:05:36 +01:00
venusbb
13c78d9b9d code style changed 2017-09-15 15:00:13 +01:00
venusbb
9de7ae11e8 filter the Notifications result by trial_service_mode 2017-09-15 14:40:56 +01:00
Rebecca Law
f624f4f033 Insert and update methods for service_sms_sender 2017-09-11 17:40:37 +01:00
Ken Tsang
d99ab329eb Refactored code to use inbound_number.number
- Removed filter on sms_sender for `dao_fetch_services_by_inbound_number`
2017-08-23 14:14:32 +01:00
Ken Tsang
5bb20e41b3 Update dao_fetch_services_by_ss_sender 2017-08-17 18:15:22 +01:00
Ken Tsang
902b28e00f Refactor to check active flag 2017-08-16 16:27:42 +01:00
Ken Tsang
c36423aac6 Refactor code for dao_fetch_servies_by_sms_sender to use inbound_numbers
This will need to be refactored after the deployment of api and admin and after the update script for existing services using inbound numbers has been executed.
2017-08-16 12:51:31 +01:00
Leo Hemsted
372b10f19c fix up tests to be internally consistent
notifications should always have at least one of job and api key, and
the key type should match the api key's key type (or be 'normal')
2017-08-02 15:35:56 +01:00
Rebecca Law
a01163d719 Merge pull request #1077 from alphagov/drop-template_stats-table
Remove the archived table template_statistics.
2017-07-12 10:41:32 +01:00
Rebecca Law
8a01a76e33 Remove the archived table template_statistics. The last time the table we updated was August 30 2016, it's safe to say we are done with it.
I updated the InboundSms and TemplateRedacted model to include an index in the db.
Dropped service_permissions.updated_at column since we are not auditting the table
2017-07-10 14:43:46 +01:00
Imdad Ahad
a9c1338873 Remove Notification, NotificationHistory status labels:
Replace labels by adding a key kwarg in the model for status.

We still need this as sqlalchemy attmempts to look for `notification_status`
on the model (Notification/NotificationHistory). To achieve true ORM mapping
(map status -> notification_status) we need the key kwarg.

More here:
http://docs.sqlalchemy.org/en/latest/core/metadata.html#sqlalchemy.schema.Column#key
2017-07-10 14:09:30 +01:00
Rebecca Law
50dbfec383 Merge pull request #1059 from alphagov/update-purge_function
Refactor order of delete statements
2017-07-07 15:32:29 +01:00
Ken Tsang
98cd838510 ken-use-only-new-service-permissions 2017-07-06 12:27:55 +01:00
Rebecca Law
f78ff4daac Refactor order of delete statements 2017-07-03 13:40:13 +01:00
Leo Hemsted
52debfb412 Load all template model relationships when archiving a service
Since the version classes hinge on delicately preserving the session,
we need to take lots of care to ensure that we don't accidentally flush
half-way through. By joinedloading the template_redacted beforehand,
we prevent a flush which would inadvertantly remove the Service object
from the session, while it's still waiting in line to be versioned.
2017-06-29 10:34:38 +01:00
Leo Hemsted
3a0bc01a55 fix service_delete function to clean up template_redacted objects properly 2017-06-28 17:19:53 +01:00
Leo Hemsted
8ad10261ec add tests for redact_template rest 2017-06-28 16:53:39 +01:00
Martyn Inglis
c57e2a6894 Merge branch 'master' into inbound-sms
Conflicts:
	app/notifications/receive_notifications.py
	tests/app/notifications/test_receive_notification.py
2017-06-01 15:56:33 +01:00
Leo Hemsted
1530908228 manually set sms_sender when creating service
sqlalchemy default doesn't appear to work correctly when there is a
difference between the DB schema and the code (ie: during a migration)
in this case, lets just set sms_sender ourselves.

we can't write unit tests for this because this only happens when the
db is in an inconsistent state 😩
2017-05-31 17:31:06 +01:00
Leo Hemsted
4a85818c34 add inbound sms table 2017-05-30 10:47:01 +01:00
Ken Tsang
7aca3d8f43 Remove flags process in service_dao.create_service 2017-05-26 12:04:16 +01:00
Ken Tsang
1375bbe400 Refactor schema to improve error response 2017-05-25 17:55:24 +01:00
Ken Tsang
f7a18f77cf Update model to cascade permissions assoc proxy 2017-05-25 17:48:09 +01:00
Ken Tsang
234312ece0 Update service permissions to ensure state in sync 2017-05-25 17:48:09 +01:00
Ken Tsang
8e3e31faaf Updated service DAO and API end points 2017-05-25 17:47:21 +01:00
Martyn Inglis
8dc7a86148 Merge branch 'master' into async-job-stats
Conflicts:
	app/dao/services_dao.py
2017-05-18 09:34:54 +01:00
Ken Tsang
54446d5f4d Add default permissions when creating a service 2017-05-17 14:18:12 +01:00
minglis
05a179c6ef Merge pull request #941 from alphagov/load-service-on-auth
Load service on auth
2017-05-17 10:49:00 +01:00
Martyn Inglis
83a1b1526e Merge branch 'master' into async-job-stats
Conflicts:
	app/notifications/notifications_ses_callback.py
2017-05-17 09:49:43 +01:00
Martyn Inglis
fd542024a3 Merge branch 'master' into load-service-on-auth 2017-05-12 16:14:44 +01:00
Martyn Inglis
889c650724 Whitespace 2017-05-12 13:09:59 +01:00
Martyn Inglis
4751673f43 Fixed service test that deletes all the things to delete the job stats too. 2017-05-12 13:08:09 +01:00
Imdad Ahad
048861b968 Add dao to get active users for service 2017-05-11 15:39:15 +01:00
Martyn Inglis
064b7436db Extra call to explicitly load API keys on service load - avoids extra calls later. 2017-05-05 15:22:21 +01:00
Leo Hemsted
7e52fa4d13 add new notification_status column to models.py
We now have a new column in the database, but it isn't being
populated. The first step is to make sure we update this column,
while still keeping the old enum based column up to date as well.

A couple of changes have had to happen to support this - one irritating
thing is that if we're ever querying columns individually, including
`Notification.status`, then we'll need to give that column a label,
since under the hood it translates to `Notification._status_enum`.
Accessing status through the ORM (i.e., my_noti.status = 'sending' or
similar) will work fine.
2017-05-04 17:24:28 +01:00
Rebecca Law
3e0221adec Change get_financial_year to return ending date as 1 microsecond earlier.
That way we can write the queries as between start and end dates, making it easier to read.
This makes more sense.
2017-05-02 10:00:47 +01:00