Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

Extends player API responses to include photoUrl field using NBA CDN headshots pattern.

Changes

  • Utility function (src/utils/playerPhotos.ts): Generates photo URLs from player IDs using https://cdn.nba.com/headshots/nba/latest/1040x760/{playerId}.png

  • Database schema: Added photo_url TEXT column to players table

  • Repository layer: Updated Player interface and upsertPlayer method with COALESCE(players.photo_url, EXCLUDED.photo_url) to preserve custom URLs when set

  • API endpoints: Both /api/v1/players and /api/v1/players/:id now include photoUrl, generating from player ID when database field is null

  • OpenAPI schema: Added photoUrl string property with URI format

Example Response

{
  "id": "237",
  "firstName": "LeBron",
  "lastName": "James",
  "photoUrl": "https://cdn.nba.com/headshots/nba/latest/1040x760/237.png",
  ...
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.balldontlie.io
    • Triggering command: /usr/local/bin/node node --import tsx server.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

As a developer, I want the API to provide player photo URLs so the frontend can display player images

Include AB#1743 in the PR description.

Work Item Details

Note: Please focus on the descriptions and information that provide context about the task requirements, functionality, and implementation details. Dates, priorities, and administrative metadata are less relevant for coding tasks.

Description

Extend the API to include player photo URLs in the player data response, following the existing team logos pattern.

Acceptance Criteria:

  • API returns photoUrl field in player responses
  • Photo URLs generated using NBA CDN or similar reliable source
  • OpenAPI schema updated to include photoUrl property
  • Utility function created following teamLogos.ts pattern

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 26, 2026 15:54
Co-authored-by: edinc <4791281+edinc@users.noreply.github.com>
Co-authored-by: edinc <4791281+edinc@users.noreply.github.com>
Co-authored-by: edinc <4791281+edinc@users.noreply.github.com>
Copilot AI changed the title [WIP] Extend API to include player photo URLs Add player photo URLs to API (AB#1743) Jan 26, 2026
Copilot AI requested a review from edinc January 26, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants