all APIs are not prefixed with /api

This commit is contained in:
azivner
2017-09-30 10:05:12 -04:00
parent ff58456332
commit e28c06ef37
17 changed files with 41 additions and 44 deletions

View File

@@ -6,7 +6,7 @@ from sql import getSingleResult
audit_api = Blueprint('audit_api', __name__)
@audit_api.route('/audit/<int:full_load_time>', methods = ['GET'])
@audit_api.route('/api/audit/<int:full_load_time>', methods = ['GET'])
@login_required
def getNote(full_load_time):
browser_id = request.headers['x-browser-id']

View File

@@ -16,7 +16,7 @@ import audit_category
notes_api = Blueprint('notes_api', __name__)
@notes_api.route('/notes/<string:note_id>', methods = ['GET'])
@notes_api.route('/api/notes/<string:note_id>', methods = ['GET'])
@login_required
def getNote(note_id):
execute("update options set opt_value = ? where opt_name = 'start_node'", [note_id])
@@ -34,7 +34,7 @@ def getNote(note_id):
'images': getResults("select * from images where note_id = ? order by note_offset", [note_id])
})
@notes_api.route('/notes/<string:note_id>', methods = ['PUT'])
@notes_api.route('/api/notes/<string:note_id>', methods = ['PUT'])
@login_required
def updateNote(note_id):
detail = getSingleResult("select * from notes where note_id = ?", [note_id])
@@ -99,7 +99,7 @@ def updateNote(note_id):
return jsonify({})
@notes_api.route('/notes/<string:note_id>', methods = ['DELETE'])
@notes_api.route('/api/notes/<string:note_id>', methods = ['DELETE'])
@login_required
def deleteNote(note_id):
children = getResults("select note_id from notes_tree where note_pid = ?", [note_id])
@@ -115,7 +115,7 @@ def deleteNote(note_id):
commit()
return jsonify({})
@notes_api.route('/notes/<string:parent_note_id>/children', methods = ['POST'])
@notes_api.route('/api/notes/<string:parent_note_id>/children', methods = ['POST'])
@login_required
def createChild(parent_note_id):
note = request.get_json(force=True)
@@ -173,7 +173,7 @@ def createChild(parent_note_id):
'note_id': noteId
})
@notes_api.route('/notes', methods = ['GET'])
@notes_api.route('/api/notes', methods = ['GET'])
@login_required
def searchNotes():
search = '%' + request.args['search'] + '%'

View File

@@ -14,14 +14,14 @@ from sql import getResults, getSingleResult
notes_history_api = Blueprint('notes_history_api', __name__)
@notes_history_api.route('/notes-history/<string:note_id>', methods = ['GET'])
@notes_history_api.route('/api/notes-history/<string:note_id>', methods = ['GET'])
@login_required
def getNoteHistory(note_id):
history = getResults("select * from notes_history where note_id = ? order by date_modified desc", [note_id])
return jsonify(history)
@notes_history_api.route('/recent-changes/', methods = ['GET'])
@notes_history_api.route('/api/recent-changes/', methods = ['GET'])
@login_required
def getRecentChanges():
recent_changes = getResults("select * from notes_history order by date_modified desc limit 1000")

View File

@@ -8,7 +8,7 @@ from sql import getSingleResult
notes_move_api = Blueprint('notes_move_api', __name__)
@notes_move_api.route('/notes/<string:note_id>/moveTo/<string:parent_id>', methods = ['PUT'])
@notes_move_api.route('/api/notes/<string:note_id>/moveTo/<string:parent_id>', methods = ['PUT'])
@login_required
def moveToNote(note_id, parent_id):
res = getSingleResult('select max(note_pos) as max_note_pos from notes_tree where note_pid = ?', [parent_id])
@@ -27,7 +27,7 @@ def moveToNote(note_id, parent_id):
commit()
return jsonify({})
@notes_move_api.route('/notes/<string:note_id>/moveBefore/<string:before_note_id>', methods = ['PUT'])
@notes_move_api.route('/api/notes/<string:note_id>/moveBefore/<string:before_note_id>', methods = ['PUT'])
def moveBeforeNote(note_id, before_note_id):
before_note = getSingleResult("select * from notes_tree where note_id = ?", [before_note_id])
@@ -42,7 +42,7 @@ def moveBeforeNote(note_id, before_note_id):
return jsonify({})
@notes_move_api.route('/notes/<string:note_id>/moveAfter/<string:after_note_id>', methods = ['PUT'])
@notes_move_api.route('/api/notes/<string:note_id>/moveAfter/<string:after_note_id>', methods = ['PUT'])
def moveAfterNote(note_id, after_note_id):
after_note = getSingleResult("select * from notes_tree where note_id = ?", [after_note_id])
@@ -57,7 +57,7 @@ def moveAfterNote(note_id, after_note_id):
return jsonify({})
@notes_move_api.route('/notes/<string:note_id>/expanded/<int:expanded>', methods = ['PUT'])
@notes_move_api.route('/api/notes/<string:note_id>/expanded/<int:expanded>', methods = ['PUT'])
def setExpandedNote(note_id, expanded):
execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, note_id])

View File

@@ -7,7 +7,7 @@ import change_password
password_api = Blueprint('password_api', __name__)
@password_api.route('/password/change', methods = ['POST'])
@password_api.route('/api/password/change', methods = ['POST'])
@login_required
def changePassword():
req = request.get_json(force=True)

View File

@@ -8,7 +8,7 @@ settings_api = Blueprint('settings_api', __name__)
allowed_options = [ 'encryption_session_timeout', 'history_snapshot_time_interval' ]
@settings_api.route('/settings', methods = ['GET'])
@settings_api.route('/api/settings', methods = ['GET'])
@login_required
def get_settings():
dict = {}
@@ -20,7 +20,7 @@ def get_settings():
return jsonify(dict)
@settings_api.route('/settings', methods = ['POST'])
@settings_api.route('/api/settings', methods = ['POST'])
@login_required
def set_settings():
req = request.get_json(force=True)

View File

@@ -188,7 +188,7 @@
</div>
<script type="text/javascript">
const baseUrl = '';
const baseApiUrl = 'api/';
</script>
<script src="stat/lib/jquery.min.js"></script>

View File

@@ -10,7 +10,7 @@ from sql import getResults, getSingleResult, getOption
tree_api = Blueprint('tree_api', __name__)
@tree_api.route('/tree', methods = ['GET'])
@tree_api.route('/api/tree', methods = ['GET'])
@login_required
def getTree():
notes = getResults("select "