app.repository.user_game_config_repository module¶
- class app.repository.user_game_config_repository.UserGameConfigRepository(session_factory)[source]¶
Bases:
BaseRepositoryRepository class for managing user-specific game configurations.
- Parameters:
session_factory (Callable[[...], AbstractAsyncContextManager[AsyncSession]])
- session_factory¶
Factory for creating SQLAlchemy sessions.
- Type:
Callable[…, AbstractAsyncContextManager[AsyncSession]]
- model¶
SQLAlchemy model class for user game configurations.
- __init__(session_factory)[source]¶
Initializes the UserGameConfigRepository.
- Parameters:
session_factory (Callable[..., AbstractAsyncContextManager[AsyncSession]]) – The session factory.
- Return type:
None
- async get_all_users_by_gameId(gameId)[source]¶
Get all users by gameId.
- Parameters:
gameId (str)
- Return type:
List[UserGameConfig]
- async get_by_user_and_game(user_id, game_id)[source]¶
Return the configuration row for a (userId, gameId) pair, or
None.- Parameters:
user_id (UUID)
game_id (UUID)
- Return type:
UserGameConfig | None
- async create_or_update(user_id, game_id, experiment_group, config_data)[source]¶
Insert a new configuration row for (userId, gameId), or update the existing one in place. Returns the persisted entity.
- Parameters:
user_id (UUID)
game_id (UUID)
experiment_group (str)
config_data (dict | None)
- Return type: