utp_service/backend/app/models/plugin.py

23 lines
916 B
Python

from datetime import datetime
from typing import Optional
from sqlalchemy import Boolean, DateTime, String, Text
from sqlalchemy.dialects.postgresql import ARRAY as PgARRAY
from sqlalchemy.orm import Mapped, mapped_column
from .base import Base
class Plugin(Base):
"""Registry of known action plugins with enable/disable control."""
__tablename__ = "plugins"
name: Mapped[str] = mapped_column(String(100), primary_key=True)
display_name: Mapped[str] = mapped_column(String(255), nullable=False)
description: Mapped[Optional[str]] = mapped_column(Text(), nullable=True)
enabled: Mapped[bool] = mapped_column(Boolean(), nullable=False, default=True)
registered_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
compatible_categories: Mapped[list[str]] = mapped_column(
PgARRAY(String()), nullable=False, default=list, server_default="{}"
)