klg-asutk-app/backend/app/models/user.py
Yuriy 0150aba4f5 Consolidation: KLG ASUTK + PAPA integration
- Unify API: lib/api.ts uses /api/v1, inbox uses /api/inbox (rewrites)
- Remove localhost refs: openapi, inbox page
- Add rewrites: /api/inbox|tmc -> inbox-server, /api/v1 -> FastAPI
- Add stub routes: knowledge/insights, recommendations, search, log-error
- Transfer from PAPA: prompts (inspection, tmc), scripts, supabase, data/tmc-requests
- Fix inbox-server: ORDER BY created_at, package.json
- Remove redundant app/api/inbox/files route (rewrites handle it)
- knowledge/ in gitignore (large PDFs)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 17:18:31 +03:00

25 lines
1002 B
Python

from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column
from app.db.base import Base
from app.models.common import TimestampMixin, uuid4_str
class User(Base, TimestampMixin):
"""Local projection of a user from ASU TK-IB.
In production, user data should be mastered by IB, and KLG stores
minimal attributes for caching and ownership logic.
"""
__tablename__ = "users"
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=uuid4_str)
external_subject: Mapped[str] = mapped_column(String(255), unique=True, index=True, nullable=False)
display_name: Mapped[str] = mapped_column(String(255), nullable=False)
email: Mapped[str | None] = mapped_column(String(255), nullable=True)
role: Mapped[str] = mapped_column(
String(64), nullable=False, doc="admin|authority_inspector|operator_user|operator_manager|mro_user|mro_manager"
)
organization_id: Mapped[str | None] = mapped_column(String(36), nullable=True)