CLAUDE: Use DELETE endpoint for clearing draft list

The API now has a DELETE /draftlist/team/{team_id} endpoint
that properly clears a team's draft list.

Updated clear_list() to use the new endpoint instead of trying
to POST an empty list, which was failing with "list index out of range"
error because the API expected at least one entry to determine team_id.

This resolves the "Clear Failed" error when using /draft-list-clear.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-10-25 19:50:30 -05:00
parent 5f69d495ab
commit 69ab4f60c3

View File

@ -276,7 +276,7 @@ class DraftListService(BaseService[DraftList]):
"""
Clear entire draft list for team.
Uses bulk replacement pattern - POSTs empty list.
Uses DELETE /draftlist/team/{team_id} endpoint.
Args:
season: Draft season
@ -294,14 +294,10 @@ class DraftListService(BaseService[DraftList]):
entry_count = len(entries)
# POST empty list (bulk replacement)
# Use DELETE endpoint: /draftlist/team/{team_id}
client = await self.get_client()
payload = {
'count': 0,
'draft_list': []
}
await client.delete(f"{self.endpoint}/team/{team_id}")
await client.post(self.endpoint, payload)
logger.info(f"Cleared {entry_count} draft list entries for team {team_id}")
return True