NPC shop implimented

This commit is contained in:
2025-11-29 01:16:46 -06:00
parent 32af625d14
commit 8bd494a52f
17 changed files with 4265 additions and 17 deletions

View File

@@ -354,8 +354,8 @@ class CharacterService:
"""
Permanently delete a character from the database.
Also cleans up any game sessions associated with the character
to prevent orphaned sessions.
Also cleans up any game sessions, shop transactions, and other
associated data to prevent orphaned records.
Args:
character_id: Character ID
@@ -375,6 +375,15 @@ class CharacterService:
if not character:
raise CharacterNotFound(f"Character not found: {character_id}")
# Clean up shop transactions for this character
from app.services.shop_service import get_shop_service
shop_service = get_shop_service()
deleted_transactions = shop_service.delete_transactions_by_character(character_id)
if deleted_transactions > 0:
logger.info("Cleaned up transactions for deleted character",
character_id=character_id,
transactions_deleted=deleted_transactions)
# Clean up associated sessions before deleting the character
# Local import to avoid circular dependency (session_service imports character_service)
from app.services.session_service import get_session_service