Skip to content

Agent district map: visual-friendly API endpoint returning district unlock state as GeoJSON-like structure #306

Description

@leocagli

Context

Issue #300 adds district unlock progress tracking. This companion issue adds a map-oriented endpoint that returns all districts in a format suitable for visualization — UI clients can render a map of unlocked vs locked districts per agent.

What to implement

Route: GET /api/agents/[id]/districts/map

Response (GeoJSON-like, renderer-agnostic):

{
  "agentId": "bot-1",
  "districts": [
    {
      "id": "sector-alpha",
      "label": "Sector Alpha",
      "status": "unlocked",
      "unlockedAt": 1719432000000,
      "xpRequired": 500,
      "xpAtUnlock": 531
    },
    {
      "id": "sector-beta",
      "label": "Sector Beta",
      "status": "locked",
      "xpRequired": 1500,
      "xpCurrent": 531,
      "progressPct": 35
    }
  ]
}

Static district metadata (lib/districts/district-registry.ts)

Labels and any future display metadata (color, icon slug) live here. Separate from unlock logic.

Acceptance criteria

🎁 Evidencia visual = reward extra

  • Si tu PR incluye video demo o capturas de pantalla mostrando la funcionalidad pedida funcionando end-to-end, va a ser considerado para rewards de GrantFox en esta issue. No es obligatorio, pero suma mucho para la evaluación.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSPart of the GrantFox OSS campaignMaybe RewardedMay be eligible for GrantFox rewardThird CampaignCampaign: Third CampaignenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions