feat: implement skills marketplace API with CRUD operations and gateway integration
This commit is contained in:
committed by
Abhimanyu Saharan
parent
db510a8612
commit
e7b5df0bce
35
backend/app/models/marketplace_skills.py
Normal file
35
backend/app/models/marketplace_skills.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Organization-scoped skill catalog entries for the skills marketplace."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from sqlmodel import Field
|
||||
|
||||
from app.core.time import utcnow
|
||||
from app.models.tenancy import TenantScoped
|
||||
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime,)
|
||||
|
||||
|
||||
class MarketplaceSkill(TenantScoped, table=True):
|
||||
"""A marketplace skill entry that can be installed onto one or more gateways."""
|
||||
|
||||
__tablename__ = "marketplace_skills" # pyright: ignore[reportAssignmentType]
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"organization_id",
|
||||
"source_url",
|
||||
name="uq_marketplace_skills_org_source_url",
|
||||
),
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
organization_id: UUID = Field(foreign_key="organizations.id", index=True)
|
||||
name: str
|
||||
description: str | None = Field(default=None)
|
||||
source_url: str
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
updated_at: datetime = Field(default_factory=utcnow)
|
||||
Reference in New Issue
Block a user