mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Remove services_dao.insert_new_service.
Update api_client.create_service to return the service id. Fix unit tests.
This commit is contained in:
@@ -3,13 +3,6 @@ from app import notifications_api_client
|
||||
from app.utils import BrowsableItem
|
||||
|
||||
|
||||
def insert_new_service(service_name, user_id):
|
||||
resp = notifications_api_client.create_service(
|
||||
service_name, False, current_app.config['DEFAULT_SERVICE_LIMIT'], True, user_id)
|
||||
|
||||
return resp['data']['id']
|
||||
|
||||
|
||||
def update_service(service):
|
||||
return notifications_api_client.update_service(
|
||||
service['id'],
|
||||
|
||||
@@ -2,8 +2,8 @@ from flask import (
|
||||
render_template,
|
||||
redirect,
|
||||
session,
|
||||
url_for
|
||||
)
|
||||
url_for,
|
||||
current_app)
|
||||
|
||||
from flask_login import login_required
|
||||
|
||||
@@ -14,8 +14,8 @@ from app.notify_client.models import InvitedUser
|
||||
|
||||
from app import (
|
||||
invite_api_client,
|
||||
user_api_client
|
||||
)
|
||||
user_api_client,
|
||||
notifications_api_client)
|
||||
|
||||
|
||||
@main.route("/add-service", methods=['GET', 'POST'])
|
||||
@@ -36,8 +36,9 @@ def add_service():
|
||||
heading = 'Which service do you want to set up notifications for?'
|
||||
if form.validate_on_submit():
|
||||
session['service_name'] = form.name.data
|
||||
user = users_dao.get_user_by_id(session['user_id'])
|
||||
service_id = services_dao.insert_new_service(session['service_name'], user.id)
|
||||
service_id = notifications_api_client.create_service(
|
||||
session['service_name'], False, current_app.config['DEFAULT_SERVICE_LIMIT'], True, session['user_id'])
|
||||
|
||||
return redirect(url_for('main.service_dashboard', service_id=service_id))
|
||||
else:
|
||||
return render_template(
|
||||
|
||||
Reference in New Issue
Block a user