def resolve_application()

in src/services/rightsizer_application_service.py [0:0]


    def resolve_application(self, event: dict) -> List[Application]:
        user_customer = event.get(PARAM_USER_CUSTOMER)
        event_application = event.get(APPLICATION_ID_ATTR)

        if user_customer == 'admin':
            # get application regardless of user customer
            if event_application:
                application = self.get_application_by_id(
                    application_id=event_application)
                if application and application.type == \
                        MAESTRO_RIGHTSIZER_APPLICATION_TYPE \
                        and not application.is_deleted:
                    return [application]
                return []
            applications = self.list()
            # return all application of RIGHTSIZER type
            return [app for app in applications
                    if app.type == MAESTRO_RIGHTSIZER_APPLICATION_TYPE
                    and not app.is_deleted]

        if event_application:
            # return application by id if it's customer matches with
            # user customer
            application = self.get_application_by_id(
                application_id=event_application)
            if application and application.customer_id == user_customer and \
                    application.type == MAESTRO_RIGHTSIZER_APPLICATION_TYPE \
                    and not application.is_deleted:
                return [application]
            return []

        # return all customer applications
        return list(self.i_get_application_by_customer(
            customer_id=user_customer,
            application_type=MAESTRO_RIGHTSIZER_APPLICATION_TYPE,
            deleted=False
        ))