diff --git a/caster-back/gencaster/schema.py b/caster-back/gencaster/schema.py index e13f7d59..1a48997a 100644 --- a/caster-back/gencaster/schema.py +++ b/caster-back/gencaster/schema.py @@ -294,7 +294,15 @@ async def delete_edge(self, info, edge_uuid: uuid.UUID) -> None: async def delete_node(self, info, node_uuid: uuid.UUID) -> None: """Deletes a given :class:`~story_graph.models.Node`.""" await graphql_check_authenticated(info) - await story_graph_models.Node.objects.filter(uuid=node_uuid).adelete() + node = await story_graph_models.Node.objects.aget(uuid=node_uuid) + if node is None: + raise Exception(f"Could not find node {node_uuid}") + if node.is_entry_node: + raise Exception( + f"Node {node_uuid} is an entry node which can not be deleted" + ) + await node.adelete() + return None @strawberry.mutation async def create_script_cells( diff --git a/caster-editor/src/components/DialogAddNode.vue b/caster-editor/src/components/DialogAddNode.vue index 16af314b..bd064dfc 100644 --- a/caster-editor/src/components/DialogAddNode.vue +++ b/caster-editor/src/components/DialogAddNode.vue @@ -71,7 +71,7 @@ const createNode = async () => {