mobiledev/taskflow

TaskFlow, a team task board you run from the web or from Claude and ChatGPT. FastAPI + DataK3 + appid + Models + MCP.

A remix template · 0 remixes · Remix mobiledev/taskflow

app/taskflow/application/ports.py

"""What the use cases need from the outside world. infrastructure/ provides it; tests fake it."""
from typing import Optional, Protocol

from taskflow.domain.model import Board, Card


class BoardRepository(Protocol):
    def get(self, board_id: str) -> Optional[Board]: ...
    def boards_for(self, email: str) -> list: ...
    def save_board(self, board: Board) -> None: ...
    def remove_membership(self, board_id: str, email: str) -> None: ...
    def get_card(self, card_id: str) -> Optional[Card]: ...
    def cards_on(self, board_id: str) -> list: ...
    def save_card(self, card: Card) -> None: ...
    def delete_card(self, card_id: str) -> None: ...
    def delete_board(self, board_id: str) -> None:
        """The board and everything on it: memberships, cards, card numbers, activity."""

    def claim_card_number(self, board_id: str, at_least: int) -> int:
        """The first free number >= at_least on this board, claimed so that two people adding
        cards at the same moment never get the same #."""

    def log(self, board_id: str, card_id: Optional[str], actor: str, action: str,
            changes: Optional[dict] = None) -> None: ...

    def activity(self, board_id: str, card_id: Optional[str] = None, limit: int = 50) -> list:
        """Newest first: [{"at": iso, "actor": email, "action": str, "changes": dict}]."""


class Assistant(Protocol):
    def checklist(self, title: str, description: str) -> list: ...
    def summarize(self, facts: str) -> str: ...
    def embed(self, texts: list) -> list: ...