in src/lambdas/modular_api_handler/processors/parent_processor.py [0:0]
def get(self, event: ParentGet):
parent_id = event.parent_id
application_id = event.application_id
if parent_id:
_LOG.debug(f'Describing parent by id \'{parent_id}\'')
parents = [self.parent_service.get_parent_by_id(
parent_id=parent_id)]
elif application_id:
_LOG.debug(f'Describing application \'{application_id}\' parents')
parents = self.parent_service.list_application_parents(
application_id=application_id,
only_active=False
)
else:
_LOG.debug('Describing all parents')
parents = self.parent_service.list()
parents = [item for item in parents if item]
if not parents:
_LOG.warning('No parents found matching given query.')
raise ResponseFactory(HTTPStatus.NOT_FOUND).message(
'No parents found matching given query.'
).exc()
_LOG.debug('Describing parent dto.')
response = [self.parent_service.get_dto(parent=parent)
for parent in parents]
_LOG.debug(f'Response: {response}')
return build_response(content=response)