Added SQL command to delete all records by user id in "userjoinedvoicechannel"-table #23
This commit is contained in:
@@ -35,3 +35,6 @@ class UserJoinedVoiceChannelRepositoryABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def delete_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): pass
|
||||
|
||||
@abstractmethod
|
||||
def delete_user_joined_voice_channel_by_user_id(self, user_id: int): pass
|
||||
|
@@ -119,3 +119,10 @@ class UserJoinedVoiceChannel(TableABC):
|
||||
DELETE FROM `UserJoinedVoiceChannel`
|
||||
WHERE `JoinId` = {self._join_id};
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def delete_by_user_id_string(id: int) -> str:
|
||||
return str(f"""
|
||||
DELETE FROM `UserJoinedVoiceChannel`
|
||||
WHERE `UserId` = {id}
|
||||
""")
|
@@ -121,3 +121,7 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB
|
||||
def delete_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel):
|
||||
self._logger.trace(__name__, f'Send SQL command: {user_joined_voice_channel.delete_string}')
|
||||
self._context.cursor.execute(user_joined_voice_channel.delete_string)
|
||||
|
||||
def delete_user_joined_voice_channel_by_user_id(self, user_id: int):
|
||||
self._logger.trace(__name__, f'Send SQL command: {UserJoinedVoiceChannel.delete_by_user_id_string}')
|
||||
self._context.cursor.execute(UserJoinedVoiceChannel.delete_by_user_id_string(user_id))
|
||||
|
Reference in New Issue
Block a user