def update(id): relation = object_or_404(Relation.by_id(id)) authz.require(authz.project_edit(relation.project)) data = request_data({'author': request.account}) relation = relations.save(data, relation=relation) db.session.commit() return jsonify(relation)
def update(id): entity = object_or_404(Entity.by_id(id)) authz.require(authz.project_edit(entity.project)) data = request_data({'author': request.account}) entity = entities.save(data, entity=entity) db.session.commit() return jsonify(entities.to_rest(entity))
def update(id): relation = object_or_404(Relation.by_id(id)) authz.require(authz.project_edit(relation.project)) data = request_data({'author': request.account}) relation = relations.save(data, relation=relation) db.session.commit() return jsonify(relations.to_rest(relation))
def create(): data = request_data({'author': request.account}) project = ProjectRef().get(data.get('project')) data['project'] = project authz.require(authz.project_edit(project)) relation = relations.save(data) db.session.commit() return jsonify(relations.to_rest(relation))
def create(): data = request_data({'author': request.account}) project = ProjectRef().get(data.get('project')) data['project'] = project authz.require(authz.project_edit(project)) file_ = files.save(data, request.files.get('file')) db.session.commit() return jsonify(file_)
def create(): data = request_data({'author': request.account}) project = ProjectRef().get(data.get('project')) data['project'] = project authz.require(authz.project_edit(project)) relation = relations.save(data) db.session.commit() return jsonify(relation)
def create(): data = request_data({'author': request.account}) project = ProjectRef().get(data.get('project')) data['project'] = project authz.require(authz.project_edit(project)) entity = entities.save(data) db.session.commit() return jsonify(entities.to_rest(entity))
def merge(): validator = entities.MergeValidator() data = validator.deserialize(request_data()) authz.require(authz.project_edit(data['orig'].project)) if data['orig'].id == data['dest'].id: raise BadRequest('Origin and destination are identical.') if data['orig'].project_id != data['dest'].project_id: raise BadRequest('Entities belong to different projects.') dest = entities.merge(data['orig'], data['dest']) db.session.commit() return jsonify(dest)
def perform_import(slug): project = object_or_404(Project.by_slug(slug)) authz.require(authz.project_edit(project)) data = request_data({'project': project}) pipeline = imports.make_importer(project, request.account, data) return jsonify(pipeline)
def delete(id): entity = object_or_404(Entity.by_id(id)) authz.require(authz.project_edit(entity.project)) entities.delete(entity) db.session.commit() raise Gone()
def delete(id): relation = object_or_404(Relation.by_id(id)) authz.require(authz.project_edit(relation.project)) relations.delete(relation) db.session.commit() raise Gone()
def delete(id): file_ = object_or_404(File.by_id(id)) authz.require(authz.project_edit(file_.project)) entities.delete(file_) db.session.commit() raise Gone()