MCPcopy Create free account
hub / github.com/alephdata/aleph / update

Function update

aleph/views/collections_api.py:114–150  ·  view source on GitHub ↗

--- post: summary: Update a collection description: > Change collection metadata and update statistics. parameters: - description: The collection ID. in: path name: collection_id required: true schema: minimum: 1

(collection_id)

Source from the content-addressed store, hash-verified

112
113@blueprint.route("/<int:collection_id>", methods=["POST", "PUT"])
114def update(collection_id):
115 """
116 ---
117 post:
118 summary: Update a collection
119 description: >
120 Change collection metadata and update statistics.
121 parameters:
122 - description: The collection ID.
123 in: path
124 name: collection_id
125 required: true
126 schema:
127 minimum: 1
128 type: integer
129 requestBody:
130 content:
131 application/json:
132 schema:
133 $ref: '#/components/schemas/CollectionUpdate'
134 tags:
135 - Collection
136 responses:
137 '200':
138 description: OK
139 content:
140 application/json:
141 schema:
142 $ref: '#/components/schemas/Collection'
143 """
144 collection = get_db_collection(collection_id, request.authz.WRITE)
145 data = parse_request("CollectionUpdate")
146 sync = get_flag("sync")
147 collection.update(data, request.authz)
148 db.session.commit()
149 data = update_collection(collection, sync=sync)
150 return CollectionSerializer.jsonify(data)
151
152
153@blueprint.route("/<int:collection_id>/reingest", methods=["POST", "PUT"])

Callers

nothing calls this directly

Calls 6

get_db_collectionFunction · 0.90
parse_requestFunction · 0.90
get_flagFunction · 0.90
update_collectionFunction · 0.90
jsonifyMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected