def board_delete(self, board_id: int = None, board_name: str = None, request_user_id: int = None) -> None: request = BoardDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, id=board_id, name=board_name, request_type=RequestType.DELETE) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) elif error.code == StorageProviderErrors.BOARD_DOES_NOT_EXIST: raise BoardDoesNotExistError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description))
def board_write(self, board_id: int = None, board_name: str = None, request_user_id: int = None) -> Board: request = BoardDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, id=board_id, name=board_name, request_type=RequestType.WRITE) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description)) return response.boards[0]
def plan_delete(self, card_id: int, request_user_id: int) -> None: request = PlanDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, interval=None, last_created=None, card_id=card_id, request_type=RequestType.DELETE) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) elif error.code == StorageProviderErrors.CARD_DOES_NOT_EXIST: raise CardDoesNotExistError(error.description) elif error.code == StorageProviderErrors.PLAN_DOES_NOT_EXIST: raise PlanDoesNotExistError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description))
def plan_write(self, card_id: int, request_user_id: int, interval: datetime.timedelta, last_created: datetime.datetime) -> Plan: request = PlanDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, interval=interval, last_created=last_created, card_id=card_id, request_type=RequestType.WRITE) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) elif error.code == StorageProviderErrors.CARD_DOES_NOT_EXIST: raise CardDoesNotExistError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description)) return response.plan
def list_read(self, board_id: Optional[int], list_id: int = None, list_name: str = None, request_user_id: int = None) -> List[CardsList]: request = ListDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, id=list_id, board_id=board_id, name=list_name, request_type=RequestType.READ) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) elif error.code == StorageProviderErrors.LIST_DOES_NOT_EXIST: raise ListDoesNotExistError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description)) return response.lists
def list_delete(self, list_id: int = None, list_name: str = None, request_user_id: int = None) -> None: if self.storage_provider.archived_list_id == list_id: raise AccessDeniedError("You can't delete this list") request = ListDataRequest(request_id=random.randrange(1000000), request_user_id=request_user_id, id=list_id, board_id=None, name=list_name, request_type=RequestType.DELETE) response, error = self.storage_provider.execute(request) if error is not None: if error.code == StorageProviderErrors.ACCESS_DENIED: raise AccessDeniedError(error.description) elif error.code == StorageProviderErrors.LIST_DOES_NOT_EXIST: raise ListDoesNotExistError(error.description) else: raise Error("""Undefined DB exception! Code: {} Description: {}""".format(error.code, error.description))