Пример #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)
Пример #3
0
def get_template_versions(service_id, template_id):
    data = template_history_schema.dump(
        dao_get_template_versions(service_id=service_id,
                                  template_id=template_id),
        many=True,
    ).data
    return jsonify(data=data)
Пример #4
0
def get_template_version(service_id, template_id, version):
    data = template_history_schema.dump(
        dao_get_template_by_id_and_service_id(
            template_id=template_id,
            service_id=service_id,
            version=version
        )
    ).data
    return jsonify(data=data)
Пример #5
0
def get_template_version(service_id, template_id, version):
    data = template_history_schema.dump(
        dao_get_template_by_id_and_service_id(
            template_id=template_id,
            service_id=service_id,
            version=version
        )
    ).data
    return jsonify(data=data)
Пример #6
0
def get_template_versions(service_id, template_id):
    data = template_history_schema.dump(
        dao_get_template_versions(service_id=service_id, template_id=template_id),
        many=True
    ).data
    return jsonify(data=data)