mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Working permissions and all tests passing.
Remove print statements. Fix for review comments.
This commit is contained in:
@@ -24,10 +24,9 @@ from app.dao.services_dao import (
|
||||
from app.dao.users_dao import get_model_users
|
||||
from app.models import ApiKey
|
||||
from app.schemas import (
|
||||
services_schema,
|
||||
service_schema,
|
||||
api_keys_schema,
|
||||
users_schema)
|
||||
api_key_schema,
|
||||
user_schema)
|
||||
from app.errors import register_errors
|
||||
|
||||
service = Blueprint('service', __name__)
|
||||
@@ -43,7 +42,7 @@ def get_services():
|
||||
services = dao_fetch_all_services_by_user(user_id)
|
||||
else:
|
||||
services = dao_fetch_all_services()
|
||||
data, errors = services_schema.dump(services)
|
||||
data, errors = service_schema.dump(services, many=True)
|
||||
return jsonify(data=data)
|
||||
|
||||
|
||||
@@ -140,7 +139,7 @@ def get_api_keys(service_id, key_id=None):
|
||||
except NoResultFound:
|
||||
return jsonify(result="error", message="API key not found for id: {}".format(service_id)), 404
|
||||
|
||||
return jsonify(apiKeys=api_keys_schema.dump(api_keys).data), 200
|
||||
return jsonify(apiKeys=api_key_schema.dump(api_keys, many=True).data), 200
|
||||
|
||||
|
||||
@service.route('/<service_id>/users', methods=['GET'])
|
||||
@@ -148,10 +147,11 @@ def get_users_for_service(service_id):
|
||||
fetched = dao_fetch_service_by_id(service_id)
|
||||
if not fetched:
|
||||
return _service_not_found(service_id)
|
||||
# TODO why is this code here, the same functionality exists without it?
|
||||
if not fetched.users:
|
||||
return jsonify(data=[])
|
||||
|
||||
result = users_schema.dump(fetched.users)
|
||||
result = user_schema.dump(fetched.users, many=True)
|
||||
return jsonify(data=result.data)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user