Skip to content

[REFACTOR] PUT and DELETE endpoints should use Squad Number (natural key) instead of UUID (surrogate key) #521

@nanotaboada

Description

@nanotaboada

Summary

The PUT /players/{player_id} and DELETE /players/{player_id} endpoints were identifying players by their internal UUID (surrogate key) instead of Squad Number (natural key), which is the domain-meaningful identifier for external consumers.

Motivation

  • squad_number is the natural key — human-readable and domain-meaningful.
  • A GET /players/squadnumber/{squad_number} endpoint already existed, making the mutation endpoints inconsistent.
  • Using UUID as a path parameter leaks an internal implementation detail into the public API contract.

Changes

  • PUT /players/squadnumber/{squad_number} — updated to accept squad_number: int
  • DELETE /players/squadnumber/{squad_number} — updated to accept squad_number: int
  • Added update_by_squad_number_async and delete_by_squad_number_async service methods

Additional Context

The natural key (squad_number) is already used for GET /players/squadnumber/{squad_number}, confirming the intent. This change aligns the mutation endpoints with that convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestplanningEnables automatic issue planning with CodeRabbitpriority highImportant for production readiness. Schedule for current milestone.pythonPull requests that update Python code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions