def standard_list():
    """
    get:
       summary: List all standards
       responses:
            200:
                description: Success response
                content:
                    application/json:
                        schema: StandardListResponseSchema
    """
    service = StandardManagerService(logger=logger)
    request = ApiRequest().parse_request(app)
    response = ApiResponse(request)
    status_code = 200

    try:
        data = service.list(request)
        total = service.count(request)

        response.set_data(data)
        response.set_total(total)

    except Exception as err:
        logger.error(err)

        if isinstance(err, ApiException):
            api_ex = err
            status_code = 404
        else:
            api_ex = ApiException(MessagesEnum.LIST_ERROR)
            status_code = 500

        response.set_exception(api_ex)
    return response.get_response(status_code)
def updates_check():
    """
            get:
                summary: Check for updates
                responses:
                    200:
                        description: Success response
                        content:
                            application/json:
                                schema: UpdatesCheckResponseSchema

            """

    service = UpdateCheckerService()
    request = ApiRequest().parse_request(app)
    response = ApiResponse(request)
    status_code = 200

    try:
        service.execute()

        total = len(service.updates)
        data = service.get_updates()

        print(total)
        print(data)
        response.set_data(data)
        response.set_total(total)

    except Exception as err:
        logger.error(err)

        if isinstance(err, ApiException):
            api_ex = err
            status_code = 404
        else:
            api_ex = ApiException(MessagesEnum.LIST_ERROR)
            status_code = 500

        response.set_exception(api_ex)

    return response.get_response(status_code)