Added logic to list game ident users #366
This commit is contained in:
@@ -14,6 +14,10 @@ class UserGameIdentRepositoryABC(ABC):
|
||||
def get_user_game_idents(self) -> List[UserGameIdent]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_game_idents_by_game_server_id(self, id: int) -> List[UserGameIdent]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_game_ident_by_id(self, id: int) -> UserGameIdent:
|
||||
pass
|
||||
|
@@ -49,6 +49,15 @@ class UserGameIdent(TableABC):
|
||||
"""
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_select_by_game_server_id_string(id: int) -> str:
|
||||
return str(
|
||||
f"""
|
||||
SELECT * FROM `UserGameIdents`
|
||||
WHERE `GameServerId` = {id};
|
||||
"""
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_select_by_id_string(id: int) -> str:
|
||||
return str(
|
||||
|
@@ -51,6 +51,19 @@ class UserGameIdentRepositoryService(UserGameIdentRepositoryABC):
|
||||
|
||||
return joins
|
||||
|
||||
def get_user_game_idents_by_game_server_id(self, game_server_id: int) -> List[UserGameIdent]:
|
||||
joins = List(UserGameIdent)
|
||||
self._logger.trace(
|
||||
__name__,
|
||||
f"Send SQL command: {UserGameIdent.get_select_by_game_server_id_string(game_server_id)}",
|
||||
)
|
||||
results = self._context.select(UserGameIdent.get_select_by_game_server_id_string(game_server_id))
|
||||
for result in results:
|
||||
self._logger.trace(__name__, f"Get UserGameIdent with id {result[0]}")
|
||||
joins.append(self._from_result(result))
|
||||
|
||||
return joins
|
||||
|
||||
def get_user_game_ident_by_id(self, id: int) -> UserGameIdent:
|
||||
self._logger.trace(
|
||||
__name__,
|
||||
|
Reference in New Issue
Block a user