feat(loyalty): translatable categories + mandatory on earn points
Some checks failed
CI / pytest (push) Failing after 2h47m45s
CI / validate (push) Successful in 39s
CI / dependency-scanning (push) Successful in 47s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
CI / ruff (push) Successful in 21s

- Add name_translations JSON column to StoreTransactionCategory
  (migration loyalty_008). Stores {"en": "Men", "fr": "Hommes", ...}.
  Model has get_translated_name(lang) helper.
- Admin CRUD form now has FR/DE/LB translation inputs alongside the
  default name.
- Points earn: category_id is now mandatory when the store has
  active categories configured. Returns CATEGORY_REQUIRED error.
- Stamps: category remains optional (quick tap workflow).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-19 14:12:55 +02:00
parent ab2daf99bd
commit eafa086c73
6 changed files with 101 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
"""loyalty 008 - add name_translations to transaction categories
Adds a JSON column for multi-language category names alongside the
existing name field (used as fallback/default).
Revision ID: loyalty_008
Revises: loyalty_007
Create Date: 2026-04-19
"""
import sqlalchemy as sa
from alembic import op
revision = "loyalty_008"
down_revision = "loyalty_007"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column(
"store_transaction_categories",
sa.Column(
"name_translations",
sa.JSON(),
nullable=True,
comment='Language-keyed name dict, e.g. {"en": "Men", "fr": "Hommes"}',
),
)
def downgrade() -> None:
op.drop_column("store_transaction_categories", "name_translations")