Improved technician config repo #127

This commit is contained in:
Sven Heidemann 2023-07-26 12:14:47 +02:00
parent 9450020d94
commit fc3bf73986
2 changed files with 50 additions and 0 deletions

View File

@ -1,6 +1,8 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from bot_data.model.technician_config import TechnicianConfig from bot_data.model.technician_config import TechnicianConfig
from bot_data.model.technician_id_config import TechnicianIdConfig
from bot_data.model.technician_ping_url_config import TechnicianPingUrlConfig
class TechnicianConfigRepositoryABC(ABC): class TechnicianConfigRepositoryABC(ABC):
@ -23,3 +25,27 @@ class TechnicianConfigRepositoryABC(ABC):
@abstractmethod @abstractmethod
def delete_technician_config(self, technician_config: TechnicianConfig): def delete_technician_config(self, technician_config: TechnicianConfig):
pass pass
@abstractmethod
def add_technician_id_config(self, technician_id: TechnicianIdConfig):
pass
@abstractmethod
def update_technician_id_config(self, technician_id: TechnicianIdConfig):
pass
@abstractmethod
def delete_technician_id_config(self, technician_id: TechnicianIdConfig):
pass
@abstractmethod
def add_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
pass
@abstractmethod
def update_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
pass
@abstractmethod
def delete_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
pass

View File

@ -65,3 +65,27 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC):
def delete_technician_config(self, technician_config: TechnicianConfig): def delete_technician_config(self, technician_config: TechnicianConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_config.delete_string}") self._logger.trace(__name__, f"Send SQL command: {technician_config.delete_string}")
self._context.cursor.execute(technician_config.delete_string) self._context.cursor.execute(technician_config.delete_string)
def add_technician_id_config(self, technician_id: TechnicianIdConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_id.insert_string}")
self._context.cursor.execute(technician_id.insert_string)
def update_technician_id_config(self, technician_id: TechnicianIdConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_id.udpate_string}")
self._context.cursor.execute(technician_id.udpate_string)
def delete_technician_id_config(self, technician_id: TechnicianIdConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_id.delete_string}")
self._context.cursor.execute(technician_id.delete_string)
def add_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.insert_string}")
self._context.cursor.execute(technician_ping_url.insert_string)
def update_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.udpate_string}")
self._context.cursor.execute(technician_ping_url.udpate_string)
def delete_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.delete_string}")
self._context.cursor.execute(technician_ping_url.delete_string)