Backend aufgeräumt und Steckdosen-Einschaltfunktion behoben
- TAPO_PASSWORD in .env korrigiert (Agent045) - Unnötige Verzeichnisse entfernt (node_modules, archiv in backend/, etc.) - .gitignore erstellt um .env-Dateien zu schützen - Projektstruktur bereinigt (von 1.5MB auf 186KB reduziert) - Flask Web UI vollständig funktionsfähig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
42
backend/migrations/versions/add_waiting_approval.py
Normal file
42
backend/migrations/versions/add_waiting_approval.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Add waiting_approval column to job table
|
||||
|
||||
Revision ID: add_waiting_approval
|
||||
Revises: af3faaa3844c
|
||||
Create Date: 2025-03-12 14:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'add_waiting_approval'
|
||||
down_revision = 'af3faaa3844c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Füge die neue Spalte waiting_approval zur job-Tabelle hinzu
|
||||
with op.batch_alter_table('job', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('waiting_approval', sa.Integer(), server_default='0', nullable=False))
|
||||
|
||||
# SQLite-kompatible Migration für die print_job-Tabelle, falls diese existiert
|
||||
try:
|
||||
with op.batch_alter_table('print_job', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('waiting_approval', sa.Boolean(), server_default='0', nullable=False))
|
||||
except Exception as e:
|
||||
print(f"Migration für print_job-Tabelle übersprungen: {e}")
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Entferne die waiting_approval-Spalte aus der job-Tabelle
|
||||
with op.batch_alter_table('job', schema=None) as batch_op:
|
||||
batch_op.drop_column('waiting_approval')
|
||||
|
||||
# SQLite-kompatible Migration für die print_job-Tabelle, falls diese existiert
|
||||
try:
|
||||
with op.batch_alter_table('print_job', schema=None) as batch_op:
|
||||
batch_op.drop_column('waiting_approval')
|
||||
except Exception as e:
|
||||
print(f"Downgrade für print_job-Tabelle übersprungen: {e}")
|
||||
81
backend/migrations/versions/af3faaa3844c_.py
Normal file
81
backend/migrations/versions/af3faaa3844c_.py
Normal file
@@ -0,0 +1,81 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: af3faaa3844c
|
||||
Revises:
|
||||
Create Date: 2025-03-11 11:16:04.961964
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'af3faaa3844c'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('printer',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('name', sa.String(length=64), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=False),
|
||||
sa.Column('status', sa.Integer(), nullable=True),
|
||||
sa.Column('ip_address', sa.String(length=15), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('printer', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_printer_name'), ['name'], unique=False)
|
||||
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('username', sa.String(length=64), nullable=True),
|
||||
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
||||
sa.Column('display_name', sa.String(length=100), nullable=True),
|
||||
sa.Column('email', sa.String(length=120), nullable=True),
|
||||
sa.Column('role', sa.String(length=20), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_user_email'), ['email'], unique=True)
|
||||
batch_op.create_index(batch_op.f('ix_user_username'), ['username'], unique=True)
|
||||
|
||||
op.create_table('print_job',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('printer_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('user_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('start_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('duration_in_minutes', sa.Integer(), nullable=False),
|
||||
sa.Column('comments', sa.Text(), nullable=True),
|
||||
sa.Column('aborted', sa.Boolean(), nullable=True),
|
||||
sa.Column('abort_reason', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['printer_id'], ['printer.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('session',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('user_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('session')
|
||||
op.drop_table('print_job')
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_user_username'))
|
||||
batch_op.drop_index(batch_op.f('ix_user_email'))
|
||||
|
||||
op.drop_table('user')
|
||||
with op.batch_alter_table('printer', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_printer_name'))
|
||||
|
||||
op.drop_table('printer')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user