diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..cc924cb --- /dev/null +++ b/.env.example @@ -0,0 +1,18 @@ +# Flask Konfiguration +SECRET_KEY=your-secret-key-here +FLASK_ENV=development +FLASK_DEBUG=True + +# Oracle Datenbank Konfiguration +ORACLE_HOST=your-oracle-host.com +ORACLE_PORT=1521 +ORACLE_SERVICE_NAME=ORCL +ORACLE_USERNAME=your_username +ORACLE_PASSWORD=your_password + +# PostgreSQL Datenbank Konfiguration (optional) +POSTGRES_HOST=your-postgres-host.com +POSTGRES_PORT=5432 +POSTGRES_DATABASE=your_database +POSTGRES_USERNAME=your_username +POSTGRES_PASSWORD=your_password \ No newline at end of file diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..b410b5b --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,54 @@ + +- [x] Verify that the copilot-instructions.md file in the .github directory is created. ✓ Completed + +- [x] Clarify Project Requirements - Python Flask web server with authentication, SQL query builder interface with table list on left, query input and results on right, ability to save and retrieve queries via API as JSON/CSV + + +- [x] Scaffold the Project - ✓ Flask project structure created with authentication, database models, routes, templates, and static files + + +- [x] Customize the Project - ✓ Completed with full query builder functionality, authentication, and API endpoints + + +- [x] Install Required Extensions - ✓ No additional extensions needed + + +- [x] Compile the Project - ✓ Completed - Python environment configured and all dependencies installed successfully + + +- [ ] Create and Run Task + + +- [ ] Launch the Project + + +- [ ] Ensure Documentation is Complete + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5731387 --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# Flask +instance/ +.webassets-cache + +# Environment variables +.env + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Database +*.db +*.sqlite +*.sqlite3 + +# Logs +*.log + +# Virtual Environment +.venv/ +venv/ +ENV/ +env/ +.env + +# Temporary files +*.tmp +*.temp \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py index b2ea99c..01286a3 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -46,7 +46,7 @@ def create_app(): from app.models import User admin = User.query.filter_by(username='admin').first() if not admin: - admin = User(username='admin', email='admin@example.com') + admin = User(username='admin', email='admin@example.com', is_admin=True) admin.set_password('admin123') db.session.add(admin) db.session.commit() diff --git a/app/__pycache__/__init__.cpython-313.pyc b/app/__pycache__/__init__.cpython-313.pyc index 7ec576d..48c7f93 100644 Binary files a/app/__pycache__/__init__.cpython-313.pyc and b/app/__pycache__/__init__.cpython-313.pyc differ diff --git a/app/templates/admin/create_user.html b/app/templates/admin/create_user.html new file mode 100644 index 0000000..96a5c45 --- /dev/null +++ b/app/templates/admin/create_user.html @@ -0,0 +1,88 @@ +{% extends "base.html" %} + +{% block title %}Neuen Benutzer erstellen{% endblock %} + +{% block content %} +
| Benutzername | +Rolle | +Erstellt am | +Aktionen | +|
|---|---|---|---|---|
| + {{ user.username }} + {% if user.id == current_user.id %} + Sie + {% endif %} + | +{{ user.email }} | ++ {% if user.is_admin %} + Administrator + {% else %} + Benutzer + {% endif %} + | +{{ user.created_at.strftime('%d.%m.%Y %H:%M') }} | ++ + + + | +
Erstellen Sie den ersten Benutzer über den Button oben.
++ Achtung: Das Löschen eines Benutzers kann nicht rückgängig gemacht werden. + Alle gespeicherten Queries dieses Benutzers gehen verloren. +
+ +| ID | +Benutzername | +Rolle | +Erstellt am | +Aktionen | +|
|---|---|---|---|---|---|
| {{ user.id }} | ++ {{ user.username }} + {% if user.id == current_user.id %} + Sie + {% endif %} + | +{{ user.email }} | +
+
+ {% if user.is_admin %}
+
+ Administrator
+
+ {% else %}
+
+ Benutzer
+
+ {% endif %}
+
+ {% if user.id != current_user.id %}
+
+ {% endif %}
+
+ |
+ {{ user.created_at.strftime('%d.%m.%Y %H:%M') }} | +
+
+
+
+
+
+ {% if user.id != current_user.id %}
+
+ {% endif %}
+
+ |
+