feat: implement skills marketplace API with CRUD operations and gateway integration
This commit is contained in:
committed by
Abhimanyu Saharan
parent
db510a8612
commit
e7b5df0bce
@@ -12,6 +12,8 @@ from app.models.board_webhook_payloads import BoardWebhookPayload
|
||||
from app.models.board_webhooks import BoardWebhook
|
||||
from app.models.boards import Board
|
||||
from app.models.gateways import Gateway
|
||||
from app.models.gateway_installed_skills import GatewayInstalledSkill
|
||||
from app.models.marketplace_skills import MarketplaceSkill
|
||||
from app.models.organization_board_access import OrganizationBoardAccess
|
||||
from app.models.organization_invite_board_access import OrganizationInviteBoardAccess
|
||||
from app.models.organization_invites import OrganizationInvite
|
||||
@@ -42,6 +44,8 @@ __all__ = [
|
||||
"BoardGroup",
|
||||
"Board",
|
||||
"Gateway",
|
||||
"GatewayInstalledSkill",
|
||||
"MarketplaceSkill",
|
||||
"Organization",
|
||||
"BoardTaskCustomField",
|
||||
"TaskCustomFieldDefinition",
|
||||
|
||||
33
backend/app/models/gateway_installed_skills.py
Normal file
33
backend/app/models/gateway_installed_skills.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""Gateway-to-skill installation state records."""
|
||||
|
||||
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.base import QueryModel
|
||||
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime,)
|
||||
|
||||
|
||||
class GatewayInstalledSkill(QueryModel, table=True):
|
||||
"""Marks that a marketplace skill is installed for a specific gateway."""
|
||||
|
||||
__tablename__ = "gateway_installed_skills" # pyright: ignore[reportAssignmentType]
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"gateway_id",
|
||||
"skill_id",
|
||||
name="uq_gateway_installed_skills_gateway_id_skill_id",
|
||||
),
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
gateway_id: UUID = Field(foreign_key="gateways.id", index=True)
|
||||
skill_id: UUID = Field(foreign_key="marketplace_skills.id", index=True)
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
updated_at: datetime = Field(default_factory=utcnow)
|
||||
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