Vue 3 + Vite 8 + TS + PrimeVue 4 (Nora/Industrial) + Pinia + vue-i18n SPA, served by the SPRO gateway as a static page-module under /module/temper_rejects. A central, login-free reject-booking terminal for all presses' tempered carts. - Implements the LOCKED design (memory: ausschuss-station): per-ttId list (newest first), left press checkbox filter (default all, greyed when no carts, hit-count badge), style-C 5-station temper belt per entry (badges + animated conveyor), 12h/1T/7T/14T/30T window, touch density. Booking dialog = PrimeVue Dialog + InputNumber + reason Select. Colours match PressV + Ausschuss #C4162A. - Python page-module wrapper: register(app) mounts committed dist/ + a no-auth API (GET /overview, GET /reasons, POST /reject). _db.py exposes run_select_query + transaction() for the future INSERT. - Backend returns SAMPLE data and POST /reject echoes success WITHOUT writing; frontend falls back to bundled sample so `npm run dev` is fully demoable offline. TODOs point at the real temper_tracking reads + the rejects INSERT (needs a DBA rejTtId column) + the login-free-write security open question. - Rich README bakes in the design, contract, wiring, open questions + Grafana embed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""Kernel DB seam for the temper_rejects page-module.
|
|
|
|
Mirrors ``modules/fastpress/press/_db.py``: DB access goes ONLY through the
|
|
kernel, re-exported here so the coupling to ``app.db`` lives in one place. This
|
|
page READS tempered carts + reject reasons and performs one narrow WRITE (insert a
|
|
reject row), so it exposes both the SELECT-only proxy and a transactional
|
|
connection::
|
|
|
|
from .._db import run_select_query, transaction
|
|
|
|
The base scaffold's API (``api/routes.py``) returns SAMPLE data and does NOT import
|
|
this yet — wiring the real reads + the ``POST /reject`` write is the next step
|
|
(see the TODO in ``api/routes.py``).
|
|
|
|
NOTE: no connection happens at import — SQLAlchemy's engine is lazy.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from contextlib import contextmanager
|
|
|
|
from app.db.mariadb import engine, run_select_query # noqa: F401 (kernel DB layer)
|
|
|
|
__all__ = ["run_select_query", "transaction", "engine"]
|
|
|
|
|
|
@contextmanager
|
|
def transaction():
|
|
"""Yield a transactional connection: commit on clean exit, rollback on error.
|
|
|
|
Thin wrapper over the kernel engine's ``begin()`` — same shape as fastpress's
|
|
reject write (``modules/fastpress/press/rejects.py``), which this page's real
|
|
``POST /reject`` will follow (one INSERT into ``production.rejects``)."""
|
|
with engine.begin() as conn:
|
|
yield conn
|