restore/export data popup, TODO: backend for restore data

This commit is contained in:
2024-03-02 15:46:44 +01:00
parent fc9b313832
commit 4f069bfb20
6 changed files with 112 additions and 7 deletions

View File

@ -144,6 +144,14 @@ def changeListContent():
except:
return str('error changing content'), 400
@app.route('/app/restore', methods=['POST'])
def restore():
data = request.get_json()
d = data.get('data')
# print(d)
restore_db(d)
return '1'
@app.route('/app/datahistory',methods = ['GET'])
def data_history_request():
if request.method == 'GET':

View File

@ -383,6 +383,17 @@ def fetch_all():
connection.close()
return results
def restore_db(data):
tables_with_uuid = ["item", "itemlist"]
tables = ["item", "itemlist", "listcontent", "history"]
connection = connect_db()
cursor = connection.cursor()
for elem in data["item"]:
print(elem)
for table in tables:
for elem in data[table]:
print(elem)
def export_csv():
'''join item and history data from database and export it in ./output.csv'''
connection = connect_db()