Commit Graph

188 Commits

Author SHA1 Message Date
Rebecca Law
c9909a4216 Merge pull request #1343 from alphagov/improve-get-services
Improve get services
2017-10-26 15:28:56 +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
Rebecca Law
61a68a2d13 [WIP] 2017-10-25 16:47:39 +01:00
Rebecca Law
a8adf4d7d7 This PR is to retain current behaviour when we allocate an inbound number for a service.
When a service is allocated an inbound number and they only have one SMS sender, then update that SMS sender to the inbound number.
That way they will not have more than one SMS sender and will not have to choose to use either one.
2017-10-25 11:58:54 +01:00
Rebecca Law
f1f2e5cd90 Fix the results to be returned in the same format that the admin app expects. 2017-10-23 15:06:11 +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
Rebecca Law
d1c9335307 If the add sms sender is for an inbound number use the number from the inbound number object, rather than the value passed in. 2017-10-19 16:29:54 +01:00
Rebecca Law
2193afe9a3 Remove 'data' from the json being returned. 2017-10-19 13:59:22 +01:00
Rebecca Law
cee916c68a As per review commemnts:
- Add the assert to a test - oops.
- Fix typo in error message.
2017-10-19 13:51:33 +01:00
Rebecca Law
709e24e267 Added endpoints to get sms senders for a service 2017-10-19 10:43:49 +01:00
Rebecca Law
6dc41c3b47 New endpoints to add and update multiple SMS sender for a service. 2017-10-19 09:58:23 +01:00
Venus Bailey
9b60d69931 Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table"" 2017-10-16 16:24:34 +01:00
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +01:00
Katie Smith
2001bfca36 Set free_sms_fragment_limit when creating a service
The free_sms_fragment_limit of a service is set when the service is
created. If a value for the free_sms_fragment_limit is not given, the
default value is used.
2017-10-12 13:54:43 +01:00
venusbb
5e2bf4cd32 Add new POST /<uuid:service_id>/letter-contact/<uuid:letter_contact_id> end point 2017-10-04 15:35:41 +01:00
Katie Smith
158e2ea181 Add endpoint to add new letter contact block
Added the '/<uuid:service_id>/letter-contact' service endpoint.
2017-10-04 15:31:45 +01:00
venusbb
212ce302c8 Add get letter contact by id endpoint
Added the GET /<uuid:service_id>/letter-contact/<uuid:letter_contact_id>
endpoint for returning a letter contact for a service with the letter contact id

Added the DAO for returning a letter contact by id
2017-10-04 12:26:38 +01:00
Katie Smith
1fa1ebb96f Add endpoint to return all letter contact blocks
Added the GET '/<uuid:service_id>/letter-contact' endpoint for returning
all letter contact blocks for a service.

Updated the DAO for service letter contacts to return the default letter
contact first.
2017-10-04 11:26:27 +01:00
Imdad Ahad
cb37ba5f78 Update schema to return default letter contact for a service 2017-10-03 10:31:21 +01:00
venusbb
9a5addb896 Reverse codes that uses filtering of trial mode services 2017-10-02 12:00:52 +01:00
Katie Smith
f90a10ab38 Merge pull request #1277 from alphagov/imdad-katie-store-multiple-letter-contacts
[2/4] Upsert into ServiceLetterContact table when updating a service
2017-10-02 10:23:20 +01:00
Imdad Ahad
f0784109a1 Upsert into letter contact table when updating a service's letter contact block 2017-09-25 16:01:24 +01:00
Imdad Ahad
fa3f4f3c20 Add dao to store letter contacts and upsert 2017-09-25 12:26:29 +01:00
venusbb
35cb7a0556 inserted missing codes 2017-09-22 15:52:11 +01:00
venusbb
4e991c26a2 Progress: Filtered day completed 2017-09-22 15:39:53 +01:00
venusbb
da21248dcf Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-platform-admin-api 2017-09-22 11:14:09 +01:00
venusbb
d59a1f447a Progress: Today stats completed 2017-09-22 11:05:36 +01:00
Rebecca Law
795bd4271c New endpoint to fetch a single reply-to email address by id 2017-09-21 17:02:58 +01:00
Rebecca Law
c6bf38e869 - is_default is required on the add_service_email_reply_to_request schema
- Added check that the service exists for the POST reply-to methods.
- Added tests
2017-09-20 11:58:18 +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
6b2c2962c9 New endpoint to insert new service reply to email address and update existing one. 2017-09-14 17:54:38 +01:00
Katie Smith
72760550bd Add endpoint to get the email reply to addresses for a service
- Changed the dao_get_reply_to_by_service_id method to return a list of
results.
- Added a GET /service/<service_id>/email-reply-to endpoint
2017-09-13 16:58:36 +01:00
Rebecca Law
f624f4f033 Insert and update methods for service_sms_sender 2017-09-11 17:40:37 +01:00
Imdad Ahad
6d0ad75a60 Upsert to new email reply to table when updating a service 2017-09-08 14:56:05 +01:00
Imdad Ahad
e1ef0e85c6 Remove monthly usage dao methods 2017-08-30 14:40:54 +01:00
Imdad Ahad
9478af0941 Remove get yearly usage endpoint 2017-08-30 14:37:27 +01:00
Rebecca Law
17f62723fa Removed unused endpoint and dao methods. 2017-08-24 16:09:48 +01:00
Leo Hemsted
c2152f9cb8 remove billable-units endpoint
it wasn't used anywhere, and the return value changed when flask was upgraded
2017-08-21 10:57:15 +01:00
Imdad Ahad
f40889e6e0 This adds new endpoints to retrieve billing data from the new table:
1. Create a separate billing blueprint to house these endpoints

2. Return monthly breakdown in same format as we did before

3. Return yearly breakdown but only return {billing units, rate,
notification_type}. Admin only makes use of these.
2017-08-17 11:10:42 +01:00
Imdad Ahad
94605d31fa Change how we populate and retrieve MonthlyBilling totals:
1. For both email and sms, store [] in monthly_totals if
there is no billing data (no notifications sent etc.) and
return this via the API

2. General refactoring of indentation
2017-08-15 16:09:42 +01:00
Rebecca Law
b227ed450a Got rid of an if 2017-08-09 15:42:40 +01:00
Rebecca Law
1ec6a3b73d Created a new service endpoint that checks if the service name or email_from is unique.
Why is this needed?
When a user updates a service name they enter the new name in a form, are then asked to confirm the change by entering their password. Then the API call to update_service is called. If we let the update serivce API call fail with the integrity constraint it will be ackward for the user.
2017-08-09 15:12:52 +01:00
Rebecca Law
9400988d72 Monthly billing - part 1
This is still a work in progress but it would be good to get some eyes on it.
This commit includes creating and updating a row in the monthly billing table and a method to fetch the results.
There is a command to populate the monthly billing for a service and month so we can try it out.
The total cost at the moment are wrong, they do not take into account the free allowance - see notes below about adding that to the table.
Left to do:
create a nightly task to run to update the monthly totals.
create an endpoint to return the yearly billing, the current day will need to be calculated on the fly and added to the totals.
Add the free allowance into the total costs.
2017-07-18 18:21:35 +01:00
Ken Tsang
b04d01ba27 Refactored code to use new service permissions only 2017-07-06 12:27:55 +01:00
Imdad Ahad
4d41da22a4 Use correct schema for dumping a notification with personalisation 2017-07-06 12:27:55 +01:00
Leo Hemsted
729faf579d block one-off sms with long content counts 2017-06-20 12:06:47 +01:00
Leo Hemsted
10b851b456 add send_notification file for handling sending one off messages
currently, they're made by creating a one-line job, but we want to
reduce task/csv file noise so we're moving them to persist in the
same vein as API usage. However, we can't just call through to that
since there are some differences:

* no api keys
* tighter control over API format
* no scheduling
* no client references

etc.

So, re-using as much of the v2 validation stuff as possible, I've
created this file that just does basic validation, and then calls
through to persist_notification and schedules a task. Woo.
2017-06-20 11:51:36 +01:00
Rebecca Law
3a66027d6a Refactor ApiKeys.secret and ServiceInboundApi.bearer_token to use the same encryption method and get rid of the duplicate code. 2017-06-19 14:32:22 +01:00
Rebecca Law
6202da7dea Update model to remove the string length restriction.
Moved logic to the dao from the endpoint.
2017-06-19 12:25:05 +01:00