33 lines
938 B
Python
33 lines
938 B
Python
from typing import TYPE_CHECKING, Any
|
|
|
|
from sqlalchemy import JSON, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.models.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from app.models.tool_instance import ToolInstance
|
|
|
|
|
|
class ToolDefinition(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "tool_definition"
|
|
|
|
key: Mapped[str] = mapped_column(
|
|
String(100), unique=True, index=True
|
|
)
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
version: Mapped[str] = mapped_column(
|
|
String(50), default="1.0.0"
|
|
)
|
|
description: Mapped[str | None] = mapped_column(
|
|
Text, nullable=True
|
|
)
|
|
image: Mapped[str] = mapped_column(Text)
|
|
manifest_data: Mapped[dict[str, Any] | None] = mapped_column(
|
|
JSON, nullable=True
|
|
)
|
|
|
|
instances: Mapped[list["ToolInstance"]] = relationship(
|
|
back_populates="tool_definition"
|
|
)
|