def references(id): enable_cache() entity = get_index_entity(id, request.authz.READ) return jsonify({ 'status': 'ok', 'results': entity_references(entity, request.authz) })
def references(entity_id): enable_cache() entity = get_index_entity(entity_id, request.authz.READ) tag_request(collection_id=entity.get('collection_id')) results = [] for prop, total in entity_references(entity, request.authz): results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, }) return jsonify({'status': 'ok', 'total': len(results), 'results': results})
def references(entity_id): enable_cache() entity = get_index_entity(entity_id, request.authz.READ) record_audit(Audit.ACT_ENTITY, id=entity_id) results = [] for prop, total in entity_references(entity, request.authz): results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, }) return jsonify({'status': 'ok', 'total': len(results), 'results': results})
def references(id): enable_cache() entity = get_index_entity(id, request.authz.READ) results = [] for prop, total in entity_references(entity, request.authz): key = ('filter:properties.%s' % prop.name, id) link = url_for('search_api.search', _query=(key, )) results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, 'results': link }) return jsonify({'status': 'ok', 'results': results})
def references(id): enable_cache() entity = get_index_entity(id, request.authz.READ) record_audit(Audit.ACT_ENTITY, id=id) results = [] for prop, total in entity_references(entity, request.authz): key = ('filter:properties.%s' % prop.name, id) link = url_for('entities_api.index', _query=(key, )) results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, 'results': link }) return jsonify({'status': 'ok', 'total': len(results), 'results': results})
def references(entity_id): enable_cache() entity = get_index_entity(entity_id, request.authz.READ) tag_request(collection_id=entity.get('collection_id')) record_audit(Audit.ACT_ENTITY, id=entity_id) results = [] for prop, total in entity_references(entity, request.authz): results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, }) return jsonify({ 'status': 'ok', 'total': len(results), 'results': results })
def references(entity_id): """ --- get: summary: Get entity references description: >- Get the schema-wise aggregation of references to the entity with id `entity_id`. This can be used to find and display adjacent entities. parameters: - in: path name: entity_id required: true schema: type: string responses: '200': description: OK content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/QueryResponse' properties: results: type: array items: $ref: '#/components/schemas/EntityReference' tags: - Entity """ enable_cache() entity = get_index_entity(entity_id, request.authz.READ) tag_request(collection_id=entity.get('collection_id')) results = [] for prop, total in entity_references(entity, request.authz): results.append({ 'count': total, 'property': prop, 'schema': prop.schema.name, }) return jsonify({ 'status': 'ok', 'total': len(results), 'results': results })