add table detection logic

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

View File

@@ -84,7 +84,20 @@ def podStatus():
# Index route # Index route
@app.route('/') @app.route('/')
def index(): def index():
return redirect('/events') # 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 # Authentication routes
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])