fix(api): delete orphaned sessions when character is deleted
- Add delete_sessions_by_character() method to SessionService that cleans up all game sessions associated with a character - Update delete_character() to hard delete instead of soft delete - Call session cleanup before deleting character to prevent orphaned data - Delete associated chat messages when cleaning up sessions - Update API documentation to reflect new behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -463,7 +463,7 @@ Set-Cookie: coc_session=<session_token>; HttpOnly; Secure; SameSite=Lax; Max-Age
|
||||
| | |
|
||||
|---|---|
|
||||
| **Endpoint** | `DELETE /api/v1/characters/<id>` |
|
||||
| **Description** | Delete character (soft delete - marks as inactive) |
|
||||
| **Description** | Permanently delete character and all associated game sessions |
|
||||
| **Auth Required** | Yes |
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
@@ -634,7 +634,7 @@ curl -X POST http://localhost:5000/api/v1/characters \
|
||||
|
||||
**Endpoint:** `DELETE /api/v1/characters/<character_id>`
|
||||
|
||||
**Description:** Soft-delete a character (marks as inactive rather than removing).
|
||||
**Description:** Permanently delete a character from the database. Also cleans up all associated game sessions to prevent orphaned data.
|
||||
|
||||
**Request:**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user