Work in progress, skeleton of the api created and testing started. Need to fix authentication tests.

This commit is contained in:
Nicholas Staples
2016-01-08 17:51:46 +00:00
parent 5bcc615825
commit 0bc4d02713
29 changed files with 193 additions and 95 deletions

View File

@@ -1,7 +0,0 @@
from flask import jsonify
from .. import main
@main.route('/', methods=['GET'])
def get_index():
return jsonify(result="hello world"), 200

View File

@@ -1,17 +1,2 @@
from flask import jsonify
from .. import main
# TODO need for health check url
# TODO remove
@main.route('/', methods=['GET'])
def get_index():
return jsonify(result="hello world"), 200
# TODO remove
@main.route('/', methods=['POST'])
def post_index():
return jsonify(result="hello world"), 200

View File

@@ -1,7 +0,0 @@
from flask import jsonify
from .. import main
@main.route('/notification', methods=['POST'])
def create_notification():
return jsonify(result="created"), 201

View File

@@ -1,38 +0,0 @@
from flask import jsonify
from app.main.dao.services_dao import (create_new_service, get_services)
from app.main.dao.users_dao import (get_users)
from .. import main
# TODO auth to be added.
@main.route('/service', methods=['POST'])
def create_service():
return jsonify(result="created"), 201
# TODO auth to be added
@main.route('/service/<int:service_id>', method=['PUT'])
def update_service(service_id):
return jsonify(result="updated")
# TODO auth to be added.
# Should be restricted by user, user id
# is pulled from the token
@main.route('/service/<int:service_id>', method=['GET'])
@main.route('/service', methods=['GET'])
def get_service(service_id=None):
services = get_services
return jsonify(
data=services
)
# TODO auth to be added
# auth should be allow for admin tokens only
@main.route('/user/<int:user_id>/service', method=['GET'])
@main.route('/user/<int:user_id>/service/<int:service_id>', method=['GET'])
def get_service_by_user_id(user_id, service_id=None):
user = get_users(user_id=user_id)
services = get_services(user, service_id=service_id)
return jsonify(data=services)