Fix custom command creator POST validation (v2.3.1)

Changed CustomCommandCreatorModel.id from required `int` to `Optional[int] = None`
to allow POST requests to create new creators without specifying an ID (database
auto-generates it).

Bug: Users couldn't create custom commands with /new-cc - API returned 422 error
"Field required" for missing id field.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-12-13 16:31:47 -06:00
parent d53b7259db
commit 99f501e748
3 changed files with 3 additions and 2 deletions

View File

@ -72,6 +72,7 @@ app/
- **Models**: Pydantic models for request/response validation - **Models**: Pydantic models for request/response validation
- **Database Access**: Direct Peewee ORM queries with automatic connection pooling - **Database Access**: Direct Peewee ORM queries with automatic connection pooling
- **Response Format**: Consistent JSON with proper HTTP status codes - **Response Format**: Consistent JSON with proper HTTP status codes
- **POST Requests**: Pydantic models for POST (create) endpoints should use `Optional[int] = None` for `id` fields since the database auto-generates IDs
### Environment Variables ### Environment Variables
**Required**: **Required**:

View File

@ -1 +1 @@
2.3.0 2.3.1

View File

@ -20,7 +20,7 @@ router = APIRouter(
# Pydantic Models for API # Pydantic Models for API
class CustomCommandCreatorModel(BaseModel): class CustomCommandCreatorModel(BaseModel):
id: int id: Optional[int] = None # Optional for POST (auto-generated), required on response
discord_id: int discord_id: int
username: str username: str
display_name: Optional[str] = None display_name: Optional[str] = None