Complete Non-Conformance Report system replacing the PowerApps/SharePoint prototype: FastAPI + SQLAlchemy 2 (async) + Alembic + MySQL 8 backend, React 18 + Vite + TypeScript + MUI frontend, Entra ID auth (MSAL / JWKS, group-gated), Microsoft Graph delegated Mail.Send notifications (OBO), six-stage workflow state machine with server-side enforcement, atomic NCR-YYYY-NNNN numbering, attachments with camera capture, immutable field-level audit trail, admin reopen, reports + CSV export, WeasyPrint PDF traveler, Power BI reporting views + read-only DB user, documented VISUAL ERP job-lookup stub, pytest suite (26 tests), docker-compose deployment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
23 lines
819 B
Python
23 lines
819 B
Python
from sqlalchemy import Boolean, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base
|
|
|
|
|
|
class Department(Base):
|
|
__tablename__ = "departments"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
name: Mapped[str] = mapped_column(String(100), unique=True)
|
|
# Deactivated values are hidden from new-NCR forms but remain valid on
|
|
# existing records; values referenced by NCRs are never hard-deleted.
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
|
class DeviationCategory(Base):
|
|
__tablename__ = "deviation_categories"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
name: Mapped[str] = mapped_column(String(100), unique=True)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|