예제 #1
0
def get_service_history(service_id):
    from app.models import (Service, ApiKey, TemplateHistory)
    from app.schemas import (service_history_schema, api_key_history_schema,
                             template_history_schema)

    service_history = Service.get_history_model().query.filter_by(
        id=service_id).all()
    service_data = service_history_schema.dump(service_history, many=True).data
    api_key_history = ApiKey.get_history_model().query.filter_by(
        service_id=service_id).all()
    api_keys_data = api_key_history_schema.dump(api_key_history,
                                                many=True).data

    template_history = TemplateHistory.query.filter_by(
        service_id=service_id).all()
    template_data, errors = template_history_schema.dump(template_history,
                                                         many=True)

    data = {
        'service_history': service_data,
        'api_key_history': api_keys_data,
        'template_history': template_data,
        'events': []
    }

    return jsonify(data=data)
예제 #2
0
def get_service_history(service_id):
    from app.models import ApiKey, Service, TemplateHistory
    from app.schemas import (
        api_key_history_schema,
        service_history_schema,
        template_history_schema,
    )

    service_history = Service.get_history_model().query.filter_by(
        id=service_id).all()
    service_data = service_history_schema.dump(service_history, many=True).data
    api_key_history = ApiKey.get_history_model().query.filter_by(
        service_id=service_id).all()
    api_keys_data = api_key_history_schema.dump(api_key_history,
                                                many=True).data

    template_history = TemplateHistory.query.filter_by(
        service_id=service_id).all()
    template_data, errors = template_history_schema.dump(template_history,
                                                         many=True)

    data = {
        "service_history": service_data,
        "api_key_history": api_keys_data,
        "template_history": template_data,
        "events": [],
    }

    return jsonify(data=data)