feat(l1): add accounts.enabled_l1_categories with default allowlist

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 14:49:14 -04:00
parent 16b9abf2e2
commit 9a5cbc35ae
3 changed files with 54 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
import uuid
from datetime import datetime, timezone
from typing import Optional, TYPE_CHECKING
from sqlalchemy import String, DateTime, ForeignKey, Boolean, Integer
from sqlalchemy import String, DateTime, ForeignKey, Boolean, Integer, text as sa_text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy.dialects.postgresql import UUID, JSONB
from app.core.database import Base
@@ -67,6 +67,17 @@ class Account(Base):
sso_provider: Mapped[Optional[str]] = mapped_column(String(20), nullable=True) # "saml" | "oidc"
sso_config: Mapped[Optional[dict]] = mapped_column(JSONB, nullable=True)
# L1 AI tree builder — per-account allowlist of problem categories
enabled_l1_categories: Mapped[list[str]] = mapped_column(
JSONB(), nullable=False,
server_default=sa_text(
"'[\"password_reset\",\"account_lockout\",\"printer\","
"\"email_outlook_client\",\"wifi_network_basics\",\"vpn_connect\","
"\"teams_zoom_av\",\"browser_cache_cookies\",\"peripheral_reconnect\","
"\"os_restart_update\"]'::jsonb"
),
)
# Relationships
owner: Mapped["User"] = relationship("User", foreign_keys=[owner_id], back_populates="owned_account")
users: Mapped[list["User"]] = relationship("User", foreign_keys="[User.account_id]", back_populates="account")