def delete_concept_instance_relationship( db: PartitionedDatabase, relationship_id_or_name: ModelRelationshipId, # ununsed id_: RecordRelationshipId, ) -> RecordRelationshipId: with db.transaction() as tx: deleted = db.delete_record_relationships_tx(tx, id_) if deleted is None or len(deleted) == 0: raise NotFound(f"Could not delete record relationship [{id_}]") return deleted[0]
def delete_concept_instance_relationships( db: PartitionedDatabase) -> List[JsonDict]: # HACK: request bodies on DELETE requests do not have defined # semantics and are not directly support by OpenAPI/Connexion. See # - https://swagger.io/docs/specification/describing-request-body # - https://github.com/zalando/connexion/issues/896 body = connexion.request.json # HACK: # since we're pulling directly from the raw body, names will not be camel cased: relationship_instance_ids: List[str] = body.get("relationshipInstanceIds", []) with db.transaction() as tx: return db.delete_record_relationships_tx(tx, *relationship_instance_ids)