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

Function create

aleph/views/mappings_api.py:110–150  ·  view source on GitHub ↗

Create a mapping. --- post: summary: Create a mapping parameters: - description: The collection id. in: path name: collection_id required: true schema: minimum: 1 type: integer example: 2 requestBody:

(collection_id)

Source from the content-addressed store, hash-verified

108
109@blueprint.route("/<int:collection_id>/mappings", methods=["POST", "PUT"])
110def create(collection_id):
111 """Create a mapping.
112 ---
113 post:
114 summary: Create a mapping
115 parameters:
116 - description: The collection id.
117 in: path
118 name: collection_id
119 required: true
120 schema:
121 minimum: 1
122 type: integer
123 example: 2
124 requestBody:
125 content:
126 application/json:
127 schema:
128 $ref: '#/components/schemas/MappingCreate'
129 responses:
130 '200':
131 content:
132 application/json:
133 schema:
134 $ref: '#/components/schemas/Mapping'
135 description: OK
136 tags:
137 - Collection
138 - Mapping
139 """
140 collection = get_db_collection(collection_id, request.authz.WRITE)
141 data = parse_request("MappingCreate")
142 mapping = Mapping.create(
143 load_query(),
144 get_table_id(data, collection),
145 collection,
146 request.authz.id,
147 entityset_id=get_entityset_id(data),
148 )
149 db.session.commit()
150 return MappingSerializer.jsonify(mapping)
151
152
153@blueprint.route("/<int:collection_id>/mappings/<int:mapping_id>", methods=["GET"])

Callers

nothing calls this directly

Calls 7

get_db_collectionFunction · 0.90
parse_requestFunction · 0.90
load_queryFunction · 0.85
get_table_idFunction · 0.85
get_entityset_idFunction · 0.85
jsonifyMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected