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)
| 108 | |
| 109 | @blueprint.route("/<int:collection_id>/mappings", methods=["POST", "PUT"]) |
| 110 | def 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"]) |
nothing calls this directly
no test coverage detected