Add genlocke creation wizard with backend API and 4-step frontend

Implements the genlocke creation feature end-to-end: Genlocke and
GenlockeLeg models with migration, POST /genlockes endpoint that
creates the genlocke with all legs and auto-starts the first run,
and a 4-step wizard UI (Name, Select Games with preset templates,
Rules, Confirm) at /genlockes/new.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Julian Tabel
2026-02-09 09:23:48 +01:00
parent aaaeb2146e
commit 7851e14c2f
18 changed files with 923 additions and 29 deletions

View File

@@ -0,0 +1,46 @@
"""add genlocke tables
Revision ID: b2c3d4e5f6a8
Revises: a1b2c3d4e5f8, b7c8d9e0f1a2
Create Date: 2026-02-09 14:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB
# revision identifiers, used by Alembic.
revision: str = 'b2c3d4e5f6a8'
down_revision: Union[str, Sequence[str], None] = ('a1b2c3d4e5f8', 'b7c8d9e0f1a2')
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'genlockes',
sa.Column('id', sa.Integer(), primary_key=True),
sa.Column('name', sa.String(100), nullable=False),
sa.Column('status', sa.String(20), nullable=False, index=True),
sa.Column('genlocke_rules', JSONB(), nullable=False, server_default='{}'),
sa.Column('nuzlocke_rules', JSONB(), nullable=False, server_default='{}'),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
)
op.create_table(
'genlocke_legs',
sa.Column('id', sa.Integer(), primary_key=True),
sa.Column('genlocke_id', sa.Integer(), sa.ForeignKey('genlockes.id', ondelete='CASCADE'), nullable=False, index=True),
sa.Column('game_id', sa.Integer(), sa.ForeignKey('games.id'), nullable=False, index=True),
sa.Column('run_id', sa.Integer(), sa.ForeignKey('nuzlocke_runs.id'), nullable=True, index=True),
sa.Column('leg_order', sa.SmallInteger(), nullable=False),
sa.UniqueConstraint('genlocke_id', 'leg_order', name='uq_genlocke_legs_order'),
)
def downgrade() -> None:
op.drop_table('genlocke_legs')
op.drop_table('genlockes')