recording note content and title changes to audit_log

This commit is contained in:
azivner
2017-09-30 21:18:23 -04:00
parent 470e1fc19f
commit 569f7a392d
4 changed files with 19 additions and 2 deletions

View File

@@ -46,6 +46,14 @@ def addAudit(category, request = None, note_id = None, change_from = None, chang
execute("INSERT INTO audit_log (date_modified, category, browser_id, note_id, change_from, change_to, comment)"
" VALUES (?, ?, ?, ?, ?, ?, ?)", [now, category, browser_id, note_id, change_from, change_to, comment])
def deleteRecentAudits(category, request, note_id):
browser_id = request.headers['x-browser-id']
delete_cutoff = math.floor(time.time()) - 10 * 60;
execute("DELETE FROM audit_log WHERE category = ? AND browser_id = ? AND note_id = ? AND date_modified > ?",
[category, browser_id, note_id, delete_cutoff])
def delete(tablename, note_id):
execute("DELETE FROM " + tablename + " WHERE note_id = ?", [note_id])