ghpsolutions/quadro

Quadro: team boards with roles, history and an MCP endpoint for Claude and ChatGPT

A remix template · 0 remixes · Remix ghpsolutions/quadro

app/boards/infrastructure/demo.py

"""Sample data for local runs (STORE=memory). Built through the use cases, like real data."""
from __future__ import annotations

from datetime import datetime, timedelta, timezone

from boards.application.use_cases import Boards
from boards.domain.model import Person
from boards.infrastructure.memory import MemoryBoards


def seeded(owner_email: str) -> MemoryBoards:
    repo = MemoryBoards()
    boards = Boards(repo)
    owner = Person(owner_email.strip().lower())
    ana, rui = "ana@example.com", "rui@example.com"
    today = datetime.now(timezone.utc).date()
    day = lambda n: (today + timedelta(days=n)).isoformat()

    ops = boards.create_board(owner, "Ops")["id"]
    boards.invite_member(owner, ops, ana, "member")
    boards.invite_member(owner, ops, rui, "viewer")
    boards.add_list(owner, ops, "Review")
    boards.update_list(owner, ops, "Review", index=2)

    a = boards.add_card(owner, ops, "Send invoice to Acme", "Doing", "October retainer.",
                        owner.email, day(-2), ["Finance"])
    b = boards.add_card(owner, ops, "Renew SSL certificate", "To do", "", ana, day(3), ["Infra"])
    c = boards.add_card(owner, ops, "Migrate backups to new bucket", "To do",
                        "Copy the last 30 days, then switch the nightly job.", ana, day(6),
                        ["Infra"])
    d = boards.add_card(owner, ops, "Publish status page", "To do", "", owner.email, day(5),
                        ["Infra", "Customer"])
    boards.add_card(owner, ops, "Quarterly tax filing", "Review", "", owner.email, day(1),
                    ["Finance"])
    boards.add_card(owner, ops, "Onboard new contractor", "Done", "", ana, day(-5), ["People"])
    boards.add_card(owner, ops, "Update the incident runbook", "To do",
                    "- [x] List contacts\n- [ ] Add escalation steps\n- [ ] Review with team",
                    owner.email, None, ["Infra"])
    boards.block(owner, d["id"], c["id"])
    boards.block(owner, c["id"], b["id"])
    boards.comment(owner, a["id"], "Acme asked for the PO number on the invoice.")
    boards.comment(Person(ana), a["id"], "PO is 4471, it's in the shared folder.")

    launch = boards.create_board(owner, "Product launch")["id"]
    boards.invite_member(owner, launch, ana, "member")
    boards.add_card(owner, launch, "Write release notes", "Doing", "", ana, day(4), ["Docs"])
    boards.add_card(owner, launch, "Pricing page copy", "To do", "", owner.email, day(2),
                    ["Marketing"])
    return repo