wip
Some checks failed
CI / test (pull_request) Failing after 16s
API CI / api-tests (pull_request) Failing after 32s

This commit is contained in:
Tim Lorsbach
2026-05-28 21:55:36 +02:00
parent f8d01e4477
commit e2da59634b
9 changed files with 50 additions and 16 deletions

View File

@ -232,5 +232,6 @@ class PESStructure(CompoundStructure):
"is_pes": True,
"pes_link": self.pes_link,
# Will overwrite image from Node
"image": f"{reverse("depict_pes")}?pesLink={urllib.parse.quote(self.pes_link)}"
"image": f"{reverse('depict_pes')}?pesLink={urllib.parse.quote(self.pes_link)}",
"image_type": "png",
}

View File

@ -75,6 +75,10 @@ def create_pes_node(request, package_uuid, pathway_uuid):
classification = pes_data.get("classificationLevel", "")
if "secret" == classification.lower():
if current_package.classification_level != Package.Classification.SECRET:
return BadRequest("Cannot create PESs for non-secret packages.")
data_pools = pes_data.get("dataPools")
if data_pools:
if s.DATA_POOL_MAPPING[current_package.data_pool.name] not in data_pools:
@ -83,6 +87,10 @@ def create_pes_node(request, package_uuid, pathway_uuid):
pes = PESCompound.create(current_package, pes_data, compound_name, compound_description)
node_qs = Node.objects.filter(pathway=current_pathway, default_node_label=pes.default_structure)
if node_qs.exists():
return redirect(current_pathway.url)
n = Node()
n.stereo_removed = False
n.pathway = current_pathway