Fixed user_joined_server repo
This commit is contained in:
parent
789186454e
commit
7e6485459b
@ -17,7 +17,7 @@ class UserJoinedServerRepositoryABC(ABC):
|
||||
def get_user_joined_server_by_id(self, id: int) -> UserJoinedServer: pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_joined_server_by_user_id(self, user_id: int) -> UserJoinedServer: pass
|
||||
def get_user_joined_servers_by_user_id(self, user_id: int) -> list[UserJoinedServer]: pass
|
||||
|
||||
@abstractmethod
|
||||
def get_active_user_joined_server_by_user_id(self, user_id: int) -> UserJoinedServer: pass
|
||||
|
@ -37,23 +37,19 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC):
|
||||
|
||||
return joins
|
||||
|
||||
def get_user_joined_server_by_id(self, id: int) -> List[UserJoinedServer]:
|
||||
joins = List(UserJoinedServer)
|
||||
def get_user_joined_server_by_id(self, id: int) -> UserJoinedServer:
|
||||
self._logger.trace(__name__, f'Send SQL command: {UserJoinedServer.get_select_by_id_string(id)}')
|
||||
results = self._context.select(UserJoinedServer.get_select_by_id_string(id))
|
||||
for result in results:
|
||||
joins.append(UserJoinedServer(
|
||||
self._users.get_user_by_id(result[1]),
|
||||
result[2],
|
||||
result[3],
|
||||
result[4],
|
||||
result[5],
|
||||
id=result[0]
|
||||
))
|
||||
|
||||
return joins
|
||||
result = self._context.select(UserJoinedServer.get_select_by_id_string(id))[0]
|
||||
return UserJoinedServer(
|
||||
self._users.get_user_by_id(result[1]),
|
||||
result[2],
|
||||
result[3],
|
||||
result[4],
|
||||
result[5],
|
||||
id=result[0]
|
||||
)
|
||||
|
||||
def get_user_joined_server_by_user_id(self, user_id: int) -> List[UserJoinedServer]:
|
||||
def get_user_joined_servers_by_user_id(self, user_id: int) -> List[UserJoinedServer]:
|
||||
joins = List(UserJoinedServer)
|
||||
self._logger.trace(__name__, f'Send SQL command: {UserJoinedServer.get_select_by_user_id_string(user_id)}')
|
||||
results = self._context.select(UserJoinedServer.get_select_by_user_id_string(user_id))
|
||||
|
Reference in New Issue
Block a user