예제 #1
0
def delete(collection_id):
    """
    ---
    delete:
      summary: Delete a collection
      description: Delete the collection with id `collection_id`
      parameters:
      - description: The collection ID.
        in: path
        name: collection_id
        required: true
        schema:
          minimum: 1
          type: integer
      - in: query
        description: Wait for delete to finish in backend.
        name: sync
        schema:
          type: boolean
      - in: query
        description: Delete only the contents, but not the collection itself.
        name: keep_metadata
        schema:
          type: boolean
      responses:
        '204':
          description: No Content
      tags:
        - Collection
    """
    collection = get_db_collection(collection_id, request.authz.WRITE)
    keep_metadata = get_flag("keep_metadata", default=False)
    sync = get_flag("sync", default=True)
    delete_collection(collection, keep_metadata=keep_metadata, sync=sync)
    return ("", 204)
예제 #2
0
 def test_delete_collection(self):
     collection = Collection.by_id(1000)
     res = self.client.get('/api/2/search?q="mention fruit"')
     assert res.json['total'] == 1, res.json
     delete_collection(collection)
     res = self.client.get('/api/2/search?q="mention fruit"')
     assert res.json['total'] == 0, res.json
예제 #3
0
 def test_delete_collection(self):
     collection = Collection.by_id(1000)
     url = '/api/2/entities?filter:schemata=Thing&q="mention fruit"'
     res = self.client.get(url)
     assert res.json['total'] == 1, res.json
     delete_collection(collection)
     res = self.client.get(url)
     assert res.json['total'] == 0, res.json
예제 #4
0
 def test_delete_collection(self):
     self.load_fixtures()
     url = "/api/2/entities?filter:schemata=Thing&q=kwazulu"
     res = self.client.get(url)
     assert res.json["total"] == 1, res.json
     delete_collection(self.public_coll)
     res = self.client.get(url)
     assert res.json["total"] == 0, res.json
예제 #5
0
 def test_delete_when_collection_deleted(self):
     data = {
         'label': 'hello',
         'collection_id': str(self.col.id),
     }
     url = '/api/2/diagrams'
     res = self.client.post(url, json=data, headers=self.headers)
     assert res.status_code == 200, res
     diagram_id = res.json['id']
     delete_collection(self.col)
     url = '/api/2/diagrams/%s' % diagram_id
     res = self.client.get(url, headers=self.headers)
     assert res.status_code == 404, res
예제 #6
0
 def test_delete_when_collection_deleted(self):
     data = {
         "label": "hello",
         "type": "list",
         "collection_id": str(self.col.id),
     }
     url = "/api/2/entitysets"
     res = self.client.post(url, json=data, headers=self.headers)
     assert res.status_code == 200, res
     entityset_id = res.json["id"]
     delete_collection(self.col)
     url = "/api/2/entitysets/%s" % entityset_id
     res = self.client.get(url, headers=self.headers)
     assert res.status_code == 404, res
예제 #7
0
def delete(collection_id):
    """
    ---
    delete:
      summary: Delete a collection
      description: Delete the collection with id `collection_id`
      parameters:
      - description: The collection ID.
        in: path
        name: collection_id
        required: true
        schema:
          minimum: 1
          type: integer
      responses:
        '204':
          description: No Content
      tags:
        - Collection
    """
    collection = get_db_collection(collection_id, request.authz.WRITE)
    sync = get_flag('sync', default=True)
    delete_collection(collection, sync=sync)
    return ('', 204)
예제 #8
0
def flush(foreign_id):
    """Reset the crawler state for a given collecton."""
    collection = get_collection(foreign_id)
    delete_collection(collection)
예제 #9
0
def delete(id):
    collection = get_db_collection(id, request.authz.WRITE)
    delete_collection(collection, sync=True)
    return ('', 204)
예제 #10
0
def flush(foreign_id, sync=False):
    """Flush all the contents for a given collection."""
    collection = get_collection(foreign_id)
    delete_collection(collection, keep_metadata=True, sync=sync)
예제 #11
0
def delete(foreign_id, sync=False):
    """Delete a given collection."""
    collection = get_collection(foreign_id)
    delete_collection(collection, sync=sync)
예제 #12
0
def flush(foreign_id):
    """Reset the crawler state for a given collecton."""
    collection = Collection.by_foreign_id(foreign_id, deleted=True)
    if collection is None:
        raise ValueError("No such collection: %r" % foreign_id)
    delete_collection(collection.id)
예제 #13
0
def delete(id):
    collection = get_db_collection(id, request.authz.WRITE)
    delete_collection(collection)
    refresh_index(collections_index())
    return ('', 204)
예제 #14
0
def delete(id):
    collection = get_db_collection(id, request.authz.WRITE)
    delete_collection(collection)
    return jsonify({'status': 'accepted'}, status=202)
예제 #15
0
파일: manage.py 프로젝트: stofstar/aleph
def delete(foreign_id):
    """Delete all the contents for a given collecton."""
    collection = get_collection(foreign_id)
    delete_collection(collection)
예제 #16
0
def delete(collection_id):
    collection = get_db_collection(collection_id, request.authz.WRITE)
    sync = get_flag('sync', default=True)
    delete_collection(collection, sync=sync)
    return ('', 204)
예제 #17
0
파일: manage.py 프로젝트: djoffrey/aleph
def delete(foreign_id, keep_metadata=False):
    """Delete all the contents for a given collecton."""
    collection = get_collection(foreign_id)
    delete_collection(collection, keep_metadata=keep_metadata)
예제 #18
0
def delete(id):
    collection = get_db_collection(id, request.authz.WRITE)
    sync = get_flag('sync', default=True)
    delete_collection(collection, sync=sync)
    return ('', 204)