def create(): """ --- post: summary: Create an entity in a collection description: >- Create an entity in a collection with a given schema and a set of given properties in the database. This is not the API you want to be using to load bulk data, but only for interactive entity manipulation in the UI. Always use the `bulk` API or for loading source datasets, no exceptions. requestBody: content: application/json: schema: $ref: '#/components/schemas/EntityCreate' responses: '200': description: Resturns the created entity content: application/json: schema: $ref: '#/components/schemas/Entity' tags: - Entity """ data = parse_request('EntityCreate') collection = ensure_dict(data.get('collection')) collection_id = data.get('collection_id', collection.get('id')) collection = get_db_collection(collection_id, request.authz.WRITE) entity_id = create_entity(data, collection, sync=True) tag_request(entity_id=entity_id, collection_id=str(collection.id)) entity = get_index_entity(entity_id, request.authz.READ) return EntitySerializer.jsonify(entity)
def create(): data = parse_request(EntityCreateSchema) collection = get_db_collection(data['collection_id'], request.authz.WRITE) entity_id = create_entity(data, collection, sync=True) tag_request(entity_id=entity_id, collection_id=str(collection.id)) entity = get_index_entity(entity_id, request.authz.READ) return EntitySerializer.jsonify(entity)
def create(): data = parse_request(EntityCreateSchema) collection = get_db_collection(data['collection_id'], request.authz.WRITE) data = create_entity(data, collection, sync=get_flag('sync', True)) tag_request(entity_id=data.get('id'), collection_id=str(collection.id)) return EntitySerializer.jsonify(data)
def create(): data = parse_request(EntityCreateSchema) collection = get_db_collection(data['collection_id'], request.authz.WRITE) data = create_entity(data, collection, sync=get_flag('sync', True)) return serialize_data(data, CombinedSchema)