Notes/src/notes_history_api.py

22 lines
689 B
Python
Raw Normal View History

2017-09-20 22:30:11 -04:00
from flask import Blueprint, jsonify
from flask_login import login_required
from sql import getResults
2017-09-20 22:30:11 -04:00
notes_history_api = Blueprint('notes_history_api', __name__)
2017-10-09 19:48:10 -04:00
2017-09-30 10:05:12 -04:00
@notes_history_api.route('/api/notes-history/<string:note_id>', methods = ['GET'])
2017-09-20 22:30:11 -04:00
@login_required
2017-10-09 19:48:10 -04:00
def get_note_history(note_id):
2017-09-21 22:20:10 -04:00
history = getResults("select * from notes_history where note_id = ? order by date_modified desc", [note_id])
2017-09-20 22:30:11 -04:00
2017-09-26 23:23:03 -04:00
return jsonify(history)
2017-10-09 19:48:10 -04:00
2017-09-30 10:05:12 -04:00
@notes_history_api.route('/api/recent-changes/', methods = ['GET'])
2017-09-26 23:23:03 -04:00
@login_required
2017-10-09 19:48:10 -04:00
def get_recent_changes():
2017-09-26 23:23:03 -04:00
recent_changes = getResults("select * from notes_history order by date_modified desc limit 1000")
return jsonify(recent_changes)