add table detection logic

This commit is contained in:
2023-03-23 20:57:37 -04:00
parent ed9f7864e8
commit 20af991841

View File

@@ -84,6 +84,19 @@ def podStatus():
# Index route
@app.route('/')
def index():
# Check for empty database, go to setup page if not setup
global tablesSetup
required_tables = ['period', 'task', 'event', 'user']
for table in required_tables:
if table in db.metadata.tables:
tablesSetup = True
else:
tablesSetup = False
break
if not tablesSetup:
return ""
# Otherwise, redirect to /events
else:
return redirect('/events')
# Authentication routes